diff --git a/commands/8ball.js b/commands/8ball.js index 5549355..b85b9a3 100644 --- a/commands/8ball.js +++ b/commands/8ball.js @@ -11,6 +11,10 @@ module.exports = { type: ApplicationCommandOptionType.String }], + async parseMessage (client, config, message, args) { + await message.channel.send(this.handle(client, config, message.author, args.slice(0).join(' '))); + }, + async parseInteraction (client, config, interaction) { await interaction.reply(this.handle(client, config, interaction.user, interaction.options.getString('question'))); }, diff --git a/commands/avatar.js b/commands/avatar.js index 909c106..75204c3 100644 --- a/commands/avatar.js +++ b/commands/avatar.js @@ -17,6 +17,11 @@ module.exports = { type: ApplicationCommandOptionType.User }], + async parseMessage (client, config, message, args) { + const target = message.mentions.users.first() || client.users.cache.get(args[0]) || message.author; + await message.channel.send(this.handle(client, config, message.author, target)); + }, + async parseInteraction (client, config, interaction) { const target = interaction.options.getUser('user') || client.users.cache.get(interaction.options.getString('userid')) || interaction.user; await interaction.reply(this.handle(client, config, interaction.user, target)); @@ -25,15 +30,12 @@ module.exports = { handle (_, config, user, target) { return { embeds: [{ - title: `:frame_photo: ${target.username}'s Beautiful Avatar!`, + title: `:frame_photo: ${target.username}'s Beautiful Profile Picture!`, + description: `[Profile picture link (Mobile users, tap here!)](${target.displayAvatarURL({ dynamic: true })})`, color: 9442302, - footer: { - icon_url: user.displayAvatarURL(), - text: config.footerTxt - }, - image: { - url: target.displayAvatarURL() - } + image: { url: target.displayAvatarURL({ dynamic: true }) }, + footer: { icon_url: user.displayAvatarURL(), text: config.footerTxt } + }] }; } diff --git a/commands/bonk.js b/commands/bonk.js index 9a8ec47..dd1a543 100644 --- a/commands/bonk.js +++ b/commands/bonk.js @@ -11,6 +11,10 @@ module.exports = { type: ApplicationCommandOptionType.User }], + async parseMessage (client, config, message) { + await message.channel.send(this.handle(client, config, message.author, message.mentions.users.first())); + }, + async parseInteraction (client, config, interaction) { await interaction.reply(this.handle(client, config, interaction.user, interaction.options.getUser('user'))); }, diff --git a/commands/cheese.js b/commands/cheese.js index 41278a8..38b8257 100644 --- a/commands/cheese.js +++ b/commands/cheese.js @@ -11,6 +11,10 @@ module.exports = { type: ApplicationCommandOptionType.User }], + async parseMessage (client, config, message) { + await message.channel.send(this.handle(client, config, message.author, message.mentions.users.first())); + }, + async parseInteraction (client, config, interaction) { await interaction.reply(this.handle(client, config, interaction.user, interaction.options.getUser('user'))); }, diff --git a/commands/choose.js b/commands/choose.js index 4c533f1..5faaee2 100644 --- a/commands/choose.js +++ b/commands/choose.js @@ -11,6 +11,13 @@ module.exports = { type: ApplicationCommandOptionType.String })), + async parseMessage (client, config, message, args) { + let [head, ...options] = message.content.split(/\s*\n\s*/); + head = head.slice(this.name.length + config.prefix.length); + if (head) options.push(head); + await message.channel.send(this.handle(client, config, message.author, options)); + }, + async parseInteraction (client, config, interaction) { console.log([...Array(10).keys()].map(i => interaction.options.getString(`option${i + 1}`)).filter(str => str)); await interaction.reply(this.handle(client, config, interaction.user, [...Array(10).keys()].map(i => interaction.options.getString(`option${i + 1}`)).filter(str => str))); diff --git a/commands/contributors.js b/commands/contributors.js index 3658af5..13a0eb2 100644 --- a/commands/contributors.js +++ b/commands/contributors.js @@ -1,9 +1,13 @@ module.exports = { name: require('path').parse(__filename).name, - description: 'Attributions to open source components used by Anitrox', + description: 'Attributions to users who have worked on Anitrox!', options: [], + async parseMessage (_, config, message) { + await message.channel.send(this.handle(config, message.author)); + }, + async parseInteraction (_, config, interaction) { await interaction.reply(this.handle(config, interaction.user)); }, @@ -24,11 +28,11 @@ module.exports = { fields: [ { name: 'chuu_shi', - value: 'Thanks to Chuu for letting me use some of his resources to host Anitrox!\n <:GitHub:778165439477841981> [Check out his code!](https://github.com/chuushi)' + value: 'Thanks to Chuu for letting me use some of his resources to host Anitrox!\n <:GitHub:778165439477841981> [Check out his code!](https://github.com/chuushi)\n <:discord:1057053513210937444> [Check out his Discord community!](https://port.chuu.sh/)' }, { - name: 'OfficialTCGMatt', - value: "Matt has helped quite a bit with Anitrox, especially in the early days of Anitrox's development! He even has his own bot!\n <:GitHub:778165439477841981> [Check out his code!](https://github.com/OfficialTCGMatt)\n :robot: [Check out TheCodingBot!](https://github.com/TMC-Software/TheCodingBot)" + name: 'TheCodingGuy', + value: "Matt has helped quite a bit with Anitrox, especially in the early days of Anitrox's development! He even has his own bot!\n <:GitHub:778165439477841981> [Check out his code!](https://github.com/Aisuruneko)\n :robot: [Check out TheCodingBot!](https://github.com/NetroCorp/TheCodingBot)\n :globe_with_meridians: [Check out Netro Corp!](https://netrocorp.net)" }, { name: 'Foxinatel', diff --git a/commands/cuddle.js b/commands/cuddle.js index 13d76cb..85067d3 100644 --- a/commands/cuddle.js +++ b/commands/cuddle.js @@ -18,6 +18,10 @@ module.exports = { type: ApplicationCommandOptionType.User }], + async parseMessage (client, config, message) { + await message.channel.send(this.handle(client, config, message.author, message.mentions.users.first())); + }, + async parseInteraction (client, config, interaction) { await interaction.reply(this.handle(client, config, interaction.user, interaction.options.getUser('user'))); }, diff --git a/commands/eval.js b/commands/eval.js index 107c573..a66e076 100644 --- a/commands/eval.js +++ b/commands/eval.js @@ -12,6 +12,10 @@ module.exports = { type: ApplicationCommandOptionType.String }], + async parseMessage (client, config, message, args) { + await message.channel.send(this.handle(client, config, message.author, args.join(' '))); + }, + async parseInteraction (client, config, interaction) { await interaction.reply(this.handle(client, config, interaction.user, interaction.options.getString('code'))); }, diff --git a/commands/help.js b/commands/help.js index 413a3e1..86f2ed8 100644 --- a/commands/help.js +++ b/commands/help.js @@ -10,6 +10,9 @@ module.exports = { required: false, type: ApplicationCommandOptionType.String }], + async parseMessage (client, config, message, args) { + await message.channel.send(this.handle(client, config, message.author, args[0])); + }, async parseInteraction (client, config, interaction) { await interaction.reply(this.handle(client, config, interaction.user, interaction.options.getString('help'))); diff --git a/commands/hug.js b/commands/hug.js index f4bc7b1..b2ade92 100644 --- a/commands/hug.js +++ b/commands/hug.js @@ -19,6 +19,10 @@ module.exports = { type: ApplicationCommandOptionType.String }], + async parseMessage (client, config, message) { + await message.channel.send(this.handle(client, config, message.author, message.mentions.users.first())); + }, + async parseInteraction (client, config, interaction) { await interaction.reply(this.handle(client, config, interaction.user, interaction.options.getUser('user'))); }, diff --git a/commands/info.js b/commands/info.js index 215f4b5..c87efd7 100644 --- a/commands/info.js +++ b/commands/info.js @@ -6,6 +6,11 @@ module.exports = { description: 'Bot and System information', options: [], + async parseMessage (client, config, message) { + await message.channel.send(this.handle(client, config, message.author)); + }, + // We'll be moving solely to Slash Commands in 1.4 + async parseInteraction (client, config, interaction) { await interaction.reply(this.handle(client, config, interaction.user)); }, @@ -26,7 +31,7 @@ module.exports = { fields: [ { name: '<:anitrox:831193012699791361> Bot Information', value: '** **' }, { name: 'Bot Name', value: `${client.user.tag}`, inline: true }, - { name: 'Bot ID', value: '``' + `${client.user.id}` + '``', inline: true }, + { name: 'Bot ID', value: `${client.user.id}`, inline: true }, { name: 'Bot Owner', value: isNaN(process.env.OWNERID) ? "Owner didn't set an OwnerID :(" : client.users.cache.get(process.env.OWNERID).username, inline: true }, { name: 'Release Type', value: config.release, inline: true }, { name: 'Version', value: config.build, inline: true }, diff --git a/commands/invite.js b/commands/invite.js index d401c78..76f1033 100644 --- a/commands/invite.js +++ b/commands/invite.js @@ -4,6 +4,10 @@ module.exports = { description: 'Add Anitrox to your beautiful server!', options: [], + async parseMessage (client, config, message) { + await message.channel.send(this.handle(client, config, message.author)); + }, + async parseInteraction (client, config, interaction) { await interaction.reply(this.handle(client, config, interaction.user)); }, @@ -23,8 +27,8 @@ module.exports = { }, fields: [ { name: 'Anitrox', value: 'Get the ripe off the vine Anitrox! \n [Add Anitrox to your server](https://discord.com/oauth2/authorize?client_id=576805923964715018&scope=bot&permissions=8)' }, - { name: 'Anitrox PTB (Public Test Build)', value: 'Anitrox PTB was discontinued on November 25th, 2022. \n [Learn More](https://docs.google.com/document/d/1cpmJjBEo-blxvirOtDsIT-Hrq40qVseRHBY7asBT47k/)' }, - { name: 'Anitrox Dev, Self hosting and more!', value: 'Self-host your own Anitrox (including dev!), Contribute, and more! The possibilites are endless.\n[Anitrox Source](https://github.com/IDeletedSystem64/anitrox)' }, + { name: 'Anitrox PTB (Public Test Build)', value: 'Anitrox PTB is going to be discontinued on November 25th, 2022. [Learn More](https://docs.google.com/document/d/1cpmJjBEo-blxvirOtDsIT-Hrq40qVseRHBY7asBT47k)' }, + { name: 'Anitrox Dev, Self hosting and more!', value: 'Self-host your own Anitrox (including dev!), Contribute, and more! The possibilites are endless. [Anitrox Source](https://github.com/IDeletedSystem64/anitrox)' }, { name: 'Need help?', value: 'Come join the Anitrox Support Server, for support and much more!\n [Anitrox Support Server](https://discord.gg/grebRGsBZ3)' } ] }] diff --git a/commands/kiss.js b/commands/kiss.js index ad8110a..aeab4fa 100644 --- a/commands/kiss.js +++ b/commands/kiss.js @@ -19,6 +19,10 @@ module.exports = { type: ApplicationCommandOptionType.User }], + async parseMessage (client, config, message) { + await message.channel.send(this.handle(client, config, message.author, message.mentions.users.first())); + }, + async parseInteraction (client, config, interaction) { await interaction.reply(this.handle(client, config, interaction.user, interaction.options.getUser('user'))); }, diff --git a/commands/leskiss.js b/commands/leskiss.js index 474e3dd..6f3f1e5 100644 --- a/commands/leskiss.js +++ b/commands/leskiss.js @@ -29,6 +29,10 @@ module.exports = { type: ApplicationCommandOptionType.User }], + async parseMessage (client, config, message) { + await message.channel.send(this.handle(client, config, message.author, message.mentions.users.first())); + }, + async parseInteraction (client, config, interaction) { await interaction.reply(this.handle(client, config, interaction.user, interaction.options.getUser('user'))); }, diff --git a/commands/lick.js b/commands/lick.js index 4595a3f..20bd0ba 100644 --- a/commands/lick.js +++ b/commands/lick.js @@ -18,6 +18,10 @@ module.exports = { type: ApplicationCommandOptionType.User }], + async parseMessage (client, config, message) { + await message.channel.send(this.handle(client, config, message.author, message.mentions.users.first())); + }, + async parseInteraction (client, config, interaction) { await interaction.reply(this.handle(client, config, interaction.user, interaction.options.getUser('user'))); }, diff --git a/commands/nom.js b/commands/nom.js index c801a8f..1d74f40 100644 --- a/commands/nom.js +++ b/commands/nom.js @@ -18,6 +18,10 @@ module.exports = { type: ApplicationCommandOptionType.User }], + async parseMessage (client, config, message) { + await message.channel.send(this.handle(client, config, message.author, message.mentions.users.first())); + }, + async parseInteraction (client, config, interaction) { await interaction.reply(this.handle(client, config, interaction.user, interaction.options.getUser('user'))); }, diff --git a/commands/pat.js b/commands/pat.js index 8f73878..9466e8b 100644 --- a/commands/pat.js +++ b/commands/pat.js @@ -17,6 +17,10 @@ module.exports = { type: ApplicationCommandOptionType.User }], + async parseMessage (client, config, message) { + await message.channel.send(this.handle(client, config, message.author, message.mentions.users.first())); + }, + async parseInteraction (client, config, interaction) { await interaction.reply(this.handle(client, config, interaction.user, interaction.options.getUser('user'))); }, diff --git a/commands/ping.js b/commands/ping.js index f45e9af..ff623e2 100644 --- a/commands/ping.js +++ b/commands/ping.js @@ -4,6 +4,10 @@ module.exports = { description: 'Gets bot ping', options: [], + async parseMessage (client, config, message, args) { + await message.channel.send(await this.handle(client, config, message.author)); + }, + async parseInteraction (client, config, interaction) { await interaction.reply(await this.handle(client, config, interaction.user)); }, diff --git a/commands/poke.js b/commands/poke.js index 38a3341..fe0e838 100644 --- a/commands/poke.js +++ b/commands/poke.js @@ -17,6 +17,10 @@ module.exports = { type: ApplicationCommandOptionType.User }], + async parseMessage (client, config, message) { + await message.channel.send(this.handle(client, config, message.author, message.mentions.users.first())); + }, + async parseInteraction (client, config, interaction) { await interaction.reply(this.handle(client, config, interaction.user, interaction.options.getUser('user'))); }, diff --git a/commands/reload.js b/commands/reload.js index 7e95046..f629461 100644 --- a/commands/reload.js +++ b/commands/reload.js @@ -11,6 +11,10 @@ module.exports = { type: ApplicationCommandOptionType.User })), + async parseMessage (client, config, message, args) { + await message.channel.send(this.handle(client, config, message.author, args)); + }, + async parseInteraction (client, config, interaction) { await interaction.reply(this.handle(client, config, interaction.user, [...Array(10).keys()].map(i => interaction.options.getString(`option${i + 1}`)).filter(str => str))); }, diff --git a/commands/restart.js b/commands/restart.js index 8c33365..fada205 100644 --- a/commands/restart.js +++ b/commands/restart.js @@ -4,6 +4,10 @@ module.exports = { description: 'Restarts the bot', options: [], + async parseMessage (client, config, message) { + await this.handle(client, config, message.author, message.channel); + }, + async parseInteraction (client, config, interaction) { await this.handle(client, config, interaction.user, interaction.channel); }, @@ -12,7 +16,7 @@ module.exports = { if (user.id === process.env.OWNERID) { const embeds = [{ title: ' Restart Bot', - description: 'Restarting Anitrox...', + description: ' Restarting now, Be back in a minute!', color: 9442302, footer: { icon_url: user.displayAvatarURL(), diff --git a/commands/slap.js b/commands/slap.js index 8ccb1cb..7fc94a4 100644 --- a/commands/slap.js +++ b/commands/slap.js @@ -11,6 +11,10 @@ module.exports = { type: ApplicationCommandOptionType.User }], + async parseMessage (client, config, message) { + await message.channel.send(this.handle(client, config, message.author, message.mentions.users.first())); + }, + async parseInteraction (client, config, interaction) { await interaction.reply(this.handle(client, config, interaction.user, interaction.options.getUser('user'))); }, diff --git a/commands/snuggle.js b/commands/snuggle.js index d159cc9..e3bf26b 100644 --- a/commands/snuggle.js +++ b/commands/snuggle.js @@ -17,6 +17,10 @@ module.exports = { type: ApplicationCommandOptionType.User }], + async parseMessage (client, config, message) { + await message.channel.send(this.handle(client, config, message.author, message.mentions.users.first())); + }, + async parseInteraction (client, config, interaction) { await interaction.reply(this.handle(client, config, interaction.user, interaction.options.getUser('user'))); }, diff --git a/commands/stop.js b/commands/stop.js index c0aca11..cb998ca 100644 --- a/commands/stop.js +++ b/commands/stop.js @@ -4,28 +4,32 @@ module.exports = { description: "IT'S TIME TO STOP!... the bot", options: [], - async parseInteraction (client, config, interaction) { - await this.handle(client, config, interaction); + async parseMessage (client, config, message) { + await this.handle(client, config, message.author, message.channel); }, - async handle (client, config, interaction) { - if (interaction.user.id === process.env.OWNERID) { - console.log('[SYSTEM] [INFO] ' + `The bot is going down for shut down. Shutdown requested by ${interaction.user.username}`); - await interaction.reply({ + async parseInteraction (client, config, interaction) { + await this.handle(client, config, interaction.user, interaction.channel); + }, + + async handle (client, config, user, channel) { + if (user.id === process.env.OWNERID) { + console.log('[SYSTEM] [INFO] ' + `The bot is going down for shut down. \nShutdown requested by ${user.username}`); + await channel.send({ embeds: [{ - title: 'Shutdown bot', - description: ' Shutting Down...', + title: 'Shut down the bot', + description: ' Shutting down now, Until next time!', color: 9442302, footer: { - icon_url: interaction.user.displayAvatarURL(), + icon_url: user.displayAvatarURL(), text: config.footerTxt } }] }); process.exit(); } else { - console.error('[SYSTEM] [ERR] User ' + interaction.user.username + " tried to shut down the bot, but doesn't have permission! If this was you, Check your config.json"); - await interaction.reply(client.generateErrorMessage('You do not have permission to run this command.', interaction.user.displayAvatarURL())); + console.error('[SYSTEM] [ERR] User ' + user.username + " tried to shut down the bot, but doesn't have permission! If this was you, Check your config.json"); + await channel.send(client.generateErrorMessage('You do not have permission to run this command.', user.displayAvatarURL())); } } }; diff --git a/commands/uinfo.js b/commands/uinfo.js index 363ff0a..69f00cc 100644 --- a/commands/uinfo.js +++ b/commands/uinfo.js @@ -11,6 +11,11 @@ module.exports = { type: ApplicationCommandOptionType.User }], + async parseMessage (client, config, message) { + const target = message.mentions.members.first() || message.member; + await message.channel.send(this.handle(client, config, message.author, target)); + }, + async parseInteraction (client, config, interaction) { const target = interaction.options.getUser('user') ? (await interaction.guild.members.fetch(interaction.options.getUser('user'))) : interaction.member; await interaction.reply(this.handle(client, config, interaction.user, target)); diff --git a/config-example.json b/config-example.json index b82129b..ff59d8e 100644 --- a/config-example.json +++ b/config-example.json @@ -1,7 +1,8 @@ { + "prefix": "n!", "release": "Developer Release", - "build": "1.4dev", - "footerTxt": "Anitrox, made with <3 by IDeletedSystem64 | 2018-2022", + "build": "1.3.3dev", + "footerTxt": "Anitrox, made with <3 by IDeletedSystem64 | 2018-2023", "sandbox": { "enabled": false, "id": "0", diff --git a/events/interactionCreate.js b/events/interactionCreate.js index 2a312cf..2cb7114 100644 --- a/events/interactionCreate.js +++ b/events/interactionCreate.js @@ -2,7 +2,6 @@ module.exports = { event: require('path').parse(__filename).name, once: false, listener: (client, config) => - async (interaction) => { try { await client.commands.get(interaction.commandName)?.parseInteraction(client, config, interaction); } catch (error) { diff --git a/events/messageCreate.js b/events/messageCreate.js new file mode 100644 index 0000000..a8cdc43 --- /dev/null +++ b/events/messageCreate.js @@ -0,0 +1,30 @@ +module.exports = { + event: require('path').parse(__filename).name, + once: false, + listener: (client, config) => + async (message) => { + if (!message.content.startsWith(config.prefix) || message.author.bot) return; + + const args = message.content.slice(config.prefix.length).split(/\s+/); + const command = args.shift()?.toLowerCase() ?? ''; + + if (!client.commands.has(command)) return; + + try { + await client.commands.get(command)?.parseMessage(client, config, message, args); + } catch (error) { + console.error(error); + message.channel.send({ + embeds: [{ + title: '<:AnitroxError:809651936563429416> **Something went wrong!**', + description: error.stack, + color: 13632027, + footer: { + icon_url: message.author.displayAvatarURL(), + text: config.footerTxt + } + }] + }); + } + } +}; diff --git a/events/ready.js b/events/ready.js index e92c037..8447da3 100644 --- a/events/ready.js +++ b/events/ready.js @@ -48,7 +48,7 @@ module.exports = { console.log('/_/ |_/_/ /_/_/\\__/_/ \\____/_/|_| '); console.log(''); console.log(`${config.release}, ${config.build}`); - console.log('Bot ready. | Anitrox by IDeletedSystem64 | Now with 100% more slash commands!'); + console.log('Bot online. | Anitrox by IDeletedSystem64 | ALL MY CODE KEEPS BLOWING UP!'); // Statuses setInterval(async () => { // Picks a status from the config file