diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/bot.ts | 3 | ||||
| -rw-r--r-- | src/commands/emma/art.ts | 202 | ||||
| -rw-r--r-- | src/commands/fun/dicksize.ts | 4 | ||||
| -rw-r--r-- | src/commands/fun/gay.ts | 4 | ||||
| -rw-r--r-- | src/config.json | 2 | ||||
| -rw-r--r-- | src/models/FanArt.ts | 13 |
6 files changed, 222 insertions, 6 deletions
@@ -35,7 +35,8 @@ client.registry ['utility', 'Utility Command Group'], ['minecraft', 'Minecraft Command Group'], ['animals', 'Animal Command Group'], - ['roleplay', 'Roleplay Command Group'] + ['roleplay', 'Roleplay Command Group'], + ['emma', 'Emma\'s Command Group'] ]) .registerDefaultGroups() .registerDefaultCommands({ diff --git a/src/commands/emma/art.ts b/src/commands/emma/art.ts new file mode 100644 index 0000000..ee8c451 --- /dev/null +++ b/src/commands/emma/art.ts @@ -0,0 +1,202 @@ +import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; +//@ts-ignore +import emoji from 'emoji-random'; +import { MessageEmbed } from 'discord.js'; +import FanArt from '../../models/FanArt'; +import mongo from 'mongoose'; +import config from '../../config.json'; +mongo.connect(config['mongodburi'], { useNewUrlParser: true, useUnifiedTopology: true }) + +module.exports = class ArtEmma extends Command { + constructor(client: CommandoClient) { + super(client, { + name: 'art', + aliases: ['artwork'], + group: 'emma', + memberName: 'art', + description: 'Allows you to submit artwork to Emma\'s artwork channel.', + args: [ + { + key: 'type', + prompt: 'What type of interaction would you like to do?', + type: 'string', + default: 'submit' + }, + { + key: 'comment', + prompt: 'Would you like to leave a comment?', + type: "string", + default: '' + } + ], + examples: [ + 'uwu!art submit <attached file>', + 'uwu!art set', + 'uwu!art remove' + ], + throttling: { + usages: 5, + duration: 30 + }, + userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'] + }); + } + //@ts-ignore not assignable bc async + run(msg: CommandoMessage, { type, comment }: any) { + const fanart = new FanArt({ + _id: mongo.Types.ObjectId(), + username: msg.author.username, + userID: msg.author.id, + guildname: msg.guild.name, + guildID: msg.guild.id, + channelname: msg.channel, + channelID: msg.channel.id, + time: msg.createdAt + }) + //let fanartServer = this.client.guilds.cache.get('663964105983393793'); + //@ts-ignore + if (msg.guild.id.toString() != '663964105983393793') return msg.reply(`You are not submitting from **Kat\'s Korner**! ${emoji.random()}`); + if (type == 'submit') { + FanArt.findOne({ guildID: msg.guild.id}, async (error, guild) => { + if (error) return console.log(error); + //@ts-ignore + let fanartServer = this.client.guilds.cache.get(guild.guildID); + //@ts-ignore + let fanartChannel = guild.channelID; + if (msg.attachments.size) { + msg.attachments.forEach(fanart => { + if (fanart.url) { + //@ts-ignore + return fanartServer?.channels.cache.get(fanartChannel)?.send(`**New fanart submitted!**\nFanart by <@${msg.author.id}>.\n\n**Comment**\n${comment ? comment : 'None'}\n\n**Video** ` + fanart.url).then(m => { + msg.delete(); + m.react('😍'); + m.react('😂'); + m.react('😁'); + m.react('😳'); + m.react('😱'); + }) + + /* let emb = new MessageEmbed() + .setDescription(`Fanart by <@${msg.author.id}>.`) + .setTitle('New fanart submitted!') + .setURL(fanart.url) + .addField('Comment', `ok`, true) + .setFooter('Do you want to submit and image or video? Do uwu!help art') + + fanartServer?.channels.cache.get('704032357640044556')?.send(emb); */ + } else + return msg.reply(`No attachment was submitted! If you need help, please do \`uwu!art help\`. ${emoji.random()}`); + } + ); + } else { + return msg.reply(`No attachment was submitted! If you need help, please do \`uwu!art help\`. ${emoji.random()}`); + } + }) + } if (type == 'help') { + // msg.guild.channels.cache.get("fanart")?.fetch().then(bool => console.log('get' + bool)) + // msg.guild.channels.cache.find(c => c.name == 'fanart')?.fetch().then(bool => console.log(bool + 'ok')) + /* msg.guild.channels.cache.find(c => c.name === 'fanart', (bool) => { + if (!bool) { + console.log('ok') + msg.guild.channels.create('fanart', { + type: 'text', + reason: 'Initialize fanart channel. This is an automated action by the Uwufier bot.', + nsfw: false + }) + console.log('made channel') + } else { + console.log('exists') + } + }) */ + let emb = new MessageEmbed() + .setTitle('Fanart - Help ' + emoji.random()) + .setColor(0xFFCC4D) + .setDescription(`How to submit fanart:`) + //@ts-ignore + .setThumbnail(msg.guild.iconURL()) + .addFields([ + { + name: '#1', + value: 'Go to the `#media` channel.' + }, + { + name: '#2', + value: 'Click on the add media button in the bottom left corner of your screen and select a video or image.' + }, + { + name: '#3', + value: 'In the message section, please put `uwu!art submit`.' + }, + { + name: '#4 (Optional)', + value: 'If you would like, you can also put a comment on your fanart, you can do this by adding an extra string to the end of your submit command. e.g. `uwu!art submit this is where the comment goes!`, if you followed the steps correctly, your comment should be `this is where the comment goes!` ' + emoji.random() + }, + { + name: 'Admin Stuff', + value: 'If you are an admin or moderator who would like to set/ remove a fanart channel, you can do this by going to to the channel you would like to set as the new fanart channel and doing `uwu!art set`, this will set the current channel as the fanart channel. To remove a fanart channel, just do `uwu!art remove`.' + }, + { + name: 'More Admin Info', + value: 'You can only have **ONE** fanart channel (I think, I haven\'t tested it lol. If you change the name of the fanart channel, you will have to re-register with the bot by simply removing and re-setting the fanart channel.' + } + ]) + + return msg.say(emb); + } else if (type == 'set') { + if (!msg.member.hasPermission('MANAGE_GUILD')) return msg.reply(`Insufficient permission! ${emoji.random()}`); + + FanArt.findOne({ guildID: msg.guild.id }, async (error, guild) => { + if (error) return console.log(error); + + if (guild) { + //@ts-ignore this exists + return msg.reply(`There already is a welcome channel set! It's ${guild.channelname}! ` + emoji.random()).then(mnotif => { + //@ts-ignore this exists + mnotif.delete({ timeout: 2000 }) + //@ts-ignore this exists + msg.delete({ timeout: 2000 }) + }) + } else if (!guild) { + await fanart.save() + .then(result => console.log(result)) + .catch(err => console.log(err)) + + return msg.reply(`The welcome channel has been set to ${msg.channel}! ${emoji.random()}`).then(mnotif => { + //@ts-ignore this exists + mnotif.delete({ timeout: 2000 }) + //@ts-ignore this exists + msg.delete({ timeout: 2000 }) + }) + } + }) + } else if (type == 'remove') { + if (!msg.member.hasPermission('MANAGE_GUILD')) return msg.reply(`Insufficient permission! ${emoji.random()}`); + + FanArt.findOne({ guildID: msg.guild.id }, async (error, guild) => { + if (error) return console.log(error); + + if (guild) { + await FanArt.findOneAndDelete({ guildID: msg.guild.id }); + return msg.say(`The current fanart channel has been unset! ${emoji.random()}`).then(mnotif => { + //@ts-ignore + mnotif.delete({ timeout: 2000 }); + //@ts-ignore + msg.delete({ timeout: 2000 }); + }) + } else if (!guild) { + return msg.reply(`There is no current fanart channel set for this guild! ${emoji.random()}`).then(m => { + //@ts-ignore + m.delete({ timeout: 2000 }) + //@ts-ignore + msg.delete({ timeout: 2000 }) + }) + } + }) + } + + /* else { + return msg.reply(`That is not a valid operation! ${emoji.random()}`); + } */ + } +};
\ No newline at end of file diff --git a/src/commands/fun/dicksize.ts b/src/commands/fun/dicksize.ts index 4e1ebd1..13986f1 100644 --- a/src/commands/fun/dicksize.ts +++ b/src/commands/fun/dicksize.ts @@ -1,4 +1,4 @@ -import { Command, CommandoMessage } from 'discord.js-commando'; +/* import { Command, CommandoMessage } from 'discord.js-commando'; import emoji from 'emoji-random'; module.exports = class DickSizeFun extends Command { @@ -34,4 +34,4 @@ module.exports = class DickSizeFun extends Command { msg.reply('Your dick size is **' + size + '** inches. ' + emoji.random()); }); } -};
\ No newline at end of file +}; */
\ No newline at end of file diff --git a/src/commands/fun/gay.ts b/src/commands/fun/gay.ts index 4148a67..a70dfc3 100644 --- a/src/commands/fun/gay.ts +++ b/src/commands/fun/gay.ts @@ -1,4 +1,4 @@ -import { Command, CommandoMessage } from 'discord.js-commando'; +/* import { Command, CommandoMessage } from 'discord.js-commando'; module.exports = class GayFun extends Command { constructor(client) { @@ -36,4 +36,4 @@ module.exports = class GayFun extends Command { msg.reply('Your gay-ness amount is **' + gayAmount + '.' + gayAmountDecimal + '%**. 🏳️🌈'); }); } -};
\ No newline at end of file +}; */
\ No newline at end of file diff --git a/src/config.json b/src/config.json index 1ddad19..9168a63 100644 --- a/src/config.json +++ b/src/config.json @@ -2,7 +2,7 @@ "secret":"Njk5NDczMjYzOTk4MjcxNDg5.XpU5oQ.btZuxVudhNllSQY6CxrXXtMJm9A", "secret-dev":"NzEyMDg4MzY5MjA2OTE5MjY5.XsMeEw.Yy0a8m2vZLDbPi7cZ8aqCalMR68", "yt-api-key":"AIzaSyCeG1lQAeInv4vjFv_eTL9IFAFNdQC9Nk8", - "version":"1.10.22", + "version":"1.10.23", "fortniteTrackerNetworkToken": "4cf21f95-5f1a-412a-b4a7-e5424adc314a", "mongodburi": "mongodb://sin:[email protected]:47107/heroku_4qrjvmb9" }
\ No newline at end of file diff --git a/src/models/FanArt.ts b/src/models/FanArt.ts new file mode 100644 index 0000000..56f63c9 --- /dev/null +++ b/src/models/FanArt.ts @@ -0,0 +1,13 @@ +import mongo from 'mongoose'; +const fanArtSchema = new mongo.Schema({ + _id: mongo.Schema.Types.ObjectId, + username: String, + userID: String, + guildname: String, + guildID: String, + channelname: String, + channelID: String, + time: String +}); + +export = mongo.model('FanArt', fanArtSchema)
\ No newline at end of file |