diff --git a/Xiao.js b/Xiao.js index 62228b19..6726171b 100644 --- a/Xiao.js +++ b/Xiao.js @@ -114,6 +114,16 @@ client.on('message', async msg => { } }); +client.on('guildCreate', async guild => { + if (!guild.systemChannel || !guild.systemChannel.permissionsFor(client.user).has('SEND_MESSAGES')) return; + try { + const usage = client.registry.commands.get('help').usage(); + await guild.systemChannel.send(`Hi! I'm Xiao, use ${usage} to see my commands, yes?`); + } catch { + return; // eslint-disable-line no-useless-return + } +}); + client.on('guildMemberRemove', async member => { if (member.id === client.user.id) return null; const channel = member.guild.systemChannel; diff --git a/commands/util-public/help.js b/commands/util-public/help.js index 2d38be7d..22f39b09 100644 --- a/commands/util-public/help.js +++ b/commands/util-public/help.js @@ -81,7 +81,7 @@ module.exports = class HelpCommand extends Command { __Command **${command.name}**__${command.guildOnly ? ' (Usable only in servers)' : ''} ${command.description}${command.details ? `\n${command.details}` : ''} - **Format:** ${msg.anyUsage(`${command.name} ${command.format || ''}`)} + **Format:** ${command.usage(command.format || '')} **Aliases:** ${command.aliases.join(', ') || 'None'} **Group:** ${command.group.name} (\`${command.groupID}:${command.memberName}\`) **NSFW:** ${command.nsfw ? 'Yes' : 'No'} diff --git a/commands/util-public/unknown-command.js b/commands/util-public/unknown-command.js index 8825d1d9..94544650 100644 --- a/commands/util-public/unknown-command.js +++ b/commands/util-public/unknown-command.js @@ -21,9 +21,8 @@ module.exports = class UnknownCommandCommand extends Command { const command = msg.content.match(this.client.dispatcher._commandPatterns[this.client.commandPrefix]); const str = command ? command[2] : msg.content.split(' ')[0]; const results = didYouMean(str, commands, { returnType: ReturnTypeEnums.ALL_SORTED_MATCHES }); - const inGuild = msg.guild ? undefined : null; return msg.reply(stripIndents` - Unknown command. Use ${msg.anyUsage('help', inGuild, inGuild)} to view the command list. + Unknown command. Use ${this.client.registry.commands.get('help').usage()} to view the command list. ${results.length ? `Did You Mean: ${results.slice(0, 5).map(c => `\`${c}\``).join(', ')}` : ''} `); diff --git a/commands/voice/airhorn.js b/commands/voice/airhorn.js index 44fae5a3..60239caf 100644 --- a/commands/voice/airhorn.js +++ b/commands/voice/airhorn.js @@ -27,10 +27,10 @@ module.exports = class AirhornCommand extends Command { } async run(msg) { - const inGuild = msg.guild ? undefined : null; const connection = this.client.voice.connections.get(msg.guild.id); if (!connection) { - return msg.reply(`I am not in a voice channel. Use ${msg.anyUsage('join', inGuild, inGuild)} to fix that!`); + const usage = this.client.registry.commands.get('join').usage(); + return msg.reply(`I am not in a voice channel. Use ${usage} to fix that!`); } const airhorn = sounds[Math.floor(Math.random() * sounds.length)]; connection.play(path.join(__dirname, '..', '..', 'assets', 'sounds', 'airhorn', airhorn)); diff --git a/commands/voice/dec-talk.js b/commands/voice/dec-talk.js index 8f52ace7..e273a431 100644 --- a/commands/voice/dec-talk.js +++ b/commands/voice/dec-talk.js @@ -49,7 +49,8 @@ module.exports = class DECTalkCommand extends Command { const inGuild = msg.guild ? undefined : null; const connection = this.client.voice.connections.get(msg.guild.id); if (!connection) { - return msg.reply(`I am not in a voice channel. Use ${msg.anyUsage('join', inGuild, inGuild)} to fix that!`); + const usage = this.client.registry.commands.get('join').usage(); + return msg.reply(`I am not in a voice channel. Use ${usage} to fix that!`); } try { const { url } = await request diff --git a/commands/voice/soundboard.js b/commands/voice/soundboard.js index e068a48a..cdb8f031 100644 --- a/commands/voice/soundboard.js +++ b/commands/voice/soundboard.js @@ -66,7 +66,8 @@ module.exports = class SoundboardCommand extends Command { const inGuild = msg.guild ? undefined : null; const connection = this.client.voice.connections.get(msg.guild.id); if (!connection) { - return msg.reply(`I am not in a voice channel. Use ${msg.anyUsage('join', inGuild, inGuild)} to fix that!`); + const usage = this.client.registry.commands.get('join').usage(); + return msg.reply(`I am not in a voice channel. Use ${usage} to fix that!`); } connection.play(path.join(__dirname, '..', '..', 'assets', 'sounds', 'soundboard', sound)); if (msg.channel.permissionsFor(this.client.user).has(['ADD_REACTIONS', 'READ_MESSAGE_HISTORY'])) { diff --git a/package.json b/package.json index dd16a2f3..fe14911d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xiao", - "version": "119.12.3", + "version": "119.12.4", "description": "Your personal server companion.", "main": "Xiao.js", "scripts": { diff --git a/structures/phone/PhoneCall.js b/structures/phone/PhoneCall.js index 25db2710..0c487ac3 100644 --- a/structures/phone/PhoneCall.js +++ b/structures/phone/PhoneCall.js @@ -41,8 +41,9 @@ module.exports = class PhoneCall { this.timeStarted = new Date(); this.setTimeout(); if (this.ownerOrigin) return this; - await this.origin.send(`☎️ **${this.recipient.guild.name}** picked up! Type \`hang up\` to hang up.`); - await this.recipient.send(`☎️ Accepted call from **${this.origin.guild.name}**. Type \`hang up\` to hang up.`); + const usage = this.client.registry.commands.get('hang-up').usage(); + await this.origin.send(`☎️ **${this.recipient.guild.name}** picked up! Use ${usage} to hang up.`); + await this.recipient.send(`☎️ Accepted call from **${this.origin.guild.name}**. Use ${usage} to hang up.`); return this; }