diff options
| author | 8cy <[email protected]> | 2020-07-06 06:08:33 -0700 |
|---|---|---|
| committer | 8cy <[email protected]> | 2020-07-06 06:08:33 -0700 |
| commit | 7fd2870037c157ea3c215e225fe42329d6af6e82 (patch) | |
| tree | fa91bc0ddfec595a86eea78f819b295b805b2bb0 /src/commands | |
| parent | add ts defs so not a lot of errors left (diff) | |
| download | dep-core-7fd2870037c157ea3c215e225fe42329d6af6e82.tar.xz dep-core-7fd2870037c157ea3c215e225fe42329d6af6e82.zip | |
add fanart for emma :star2:
Diffstat (limited to 'src/commands')
| -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 |
3 files changed, 206 insertions, 4 deletions
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 |