diff options
| author | 8cy <[email protected]> | 2020-04-23 11:48:22 -0700 |
|---|---|---|
| committer | 8cy <[email protected]> | 2020-04-23 11:48:22 -0700 |
| commit | 02b211b23bb7f95895c7e7f9dbf16983b13692af (patch) | |
| tree | 0b92429799ad61cc0f1d676e9be03389c44155a8 /src | |
| parent | change invite link, v.7.3.6 (diff) | |
| download | dep-core-02b211b23bb7f95895c7e7f9dbf16983b13692af.tar.xz dep-core-02b211b23bb7f95895c7e7f9dbf16983b13692af.zip | |
DARLING in the FRANXX, v7.4.0
- add mongo db support
- add zero two darling cmd
Diffstat (limited to 'src')
| -rw-r--r-- | src/app.ts | 4 | ||||
| -rw-r--r-- | src/bot.ts | 5 | ||||
| -rw-r--r-- | src/commands/utility/memorystats.ts | 2 | ||||
| -rw-r--r-- | src/commands/utility/memoryusage.ts | 2 | ||||
| -rw-r--r-- | src/commands/utility/version.ts | 2 | ||||
| -rw-r--r-- | src/commands/zerotwo/darling.ts | 60 | ||||
| -rw-r--r-- | src/models/darling.ts | 11 |
7 files changed, 81 insertions, 5 deletions
@@ -1,7 +1,7 @@ import { ShardingManager } from 'discord.js'; import config from './config.json'; -const manager = new ShardingManager('./dist/bot.js', { token: config['secret'] }); -//const manager = new ShardingManager('./bot.js', { token: config['secret'] }); +//const manager = new ShardingManager('./dist/bot.js', { token: config['secret'] }); +const manager = new ShardingManager('./bot.js', { token: config['secret'] }); manager.spawn(); console.log('\x1b[0m' + 'Connecting...'); @@ -35,7 +35,8 @@ client.registry ['voice', 'Voice Command Group'], ['nsfw', 'NSFW Command Group'], ['anime', 'Anime Command Group'], - ['crypto', 'Crypto Command Group'] + ['crypto', 'Crypto Command Group'], + ['zerotwo', 'Zero Two Command Group'] ]) .registerDefaultGroups() .registerDefaultCommands({ @@ -62,7 +63,7 @@ client.once('ready', () => { console.log('\x1b[0m' + 'Servers: ' + '\x1b[36m' + `${client.guilds.cache.size}` + '\x1b[0m') console.log() - client.user.setActivity('uwu!help | v7.3.6', { + client.user.setActivity('uwu!help | v7.4.0', { type: 'WATCHING' }); }); diff --git a/src/commands/utility/memorystats.ts b/src/commands/utility/memorystats.ts index 43dbd13..0729fc5 100644 --- a/src/commands/utility/memorystats.ts +++ b/src/commands/utility/memorystats.ts @@ -17,6 +17,8 @@ module.exports = class MemoryStatsUtility extends Command { group: 'utility', memberName: 'memorystats', description: 'Checks the full, current, approximate memory usage statistics of the bot\'s Node.js process.', + userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'] }); } run(msg: CommandoMessage) { diff --git a/src/commands/utility/memoryusage.ts b/src/commands/utility/memoryusage.ts index a4f52c0..3c2913a 100644 --- a/src/commands/utility/memoryusage.ts +++ b/src/commands/utility/memoryusage.ts @@ -16,6 +16,8 @@ module.exports = class MemoryUsageUtility extends Command { group: 'utility', memberName: 'memoryusage', description: 'Checks the current, approximate memory usage of the bot\'s Node.js process.', + userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'] }); } run(msg: CommandoMessage) { diff --git a/src/commands/utility/version.ts b/src/commands/utility/version.ts index b8d65eb..e23514e 100644 --- a/src/commands/utility/version.ts +++ b/src/commands/utility/version.ts @@ -25,7 +25,7 @@ export default class VersionUtility extends Command { m.edit(`** **`); let emb = new MessageEmbed() - .setDescription('uwufier\'s current build version is **v7.3.6**. ' + emoji.random()) + .setDescription('uwufier\'s current build version is **v7.4.0**. ' + emoji.random()) .setColor(0xFFCC4D) msg.channel.send(emb); diff --git a/src/commands/zerotwo/darling.ts b/src/commands/zerotwo/darling.ts new file mode 100644 index 0000000..2c72c1c --- /dev/null +++ b/src/commands/zerotwo/darling.ts @@ -0,0 +1,60 @@ +import { Command, CommandoMessage } from 'discord.js-commando'; +import Darling from '../../models/darling.js'; +import mongo from 'mongoose'; +mongo.connect('mongodb+srv://sin:[email protected]/test?retryWrites=true&w=majority') + +module.exports = class DarlingZeroTwo extends Command { + constructor(client) { + super(client, { + name: 'darling', + group: 'zerotwo', + memberName: 'darling', + description: 'Get\'s or sets uwufier\'s current darling.', + userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + examples: ['uwu!darling'], + args: [ + { + key: 'darlingName', + prompt: 'Who should the darling be?', + type: 'string', + default: '' + } + ] + }); + } + async run(msg: CommandoMessage, { darlingName }) { + const darling = new Darling({ + _id: mongo.Types.ObjectId(), + username: msg.author.username, + userID: msg.author.id, + guildname: msg.guild.name, + guildID: msg.guild.id, + time: msg.createdAt + }) + const guildExist = await Darling.findOne({ guildID: msg.guild.id }) + + if (guildExist && darlingName == 'remove') { + await Darling.findOneAndDelete({ guildID: msg.guild.id }) + msg.say('The current darling has been removed.') + } else if (!guildExist && darlingName == 'remove') { + msg.reply('There is no darling set in this server.') + } else if (darlingName || darlingName == 'set') { + await darling.save().then(result => console.log(result)).catch(err => console.log(err)) + + var quoteNum = Math.floor((Math.random() * 3) + 1); + switch (quoteNum) { + case 1: var quoteResult = 'I think I have taken a liking to you. Won\'t you be my darling?'; break + case 2: var quoteResult = 'I like the look in your eyes. It makes my heart race. You are now my darling!'; break + case 3: var quoteResult = 'Wow, your taste makes my heart race. It bites and lingers... The taste of danger. You are now my darling!'; break + default: var quoteResult = 'I think I have taken a liking to you. Won\'t you be my darling?'; break + } + msg.reply(quoteResult) + } else if (!guildExist) { + msg.reply('I haven\'t found my darling yet!') + } else if (guildExist) { + let result = await Darling.findOne({ userID: msg.author.id }) + msg.reply(`My darling is <@${result.userID}>`) + } + } +};
\ No newline at end of file diff --git a/src/models/darling.ts b/src/models/darling.ts new file mode 100644 index 0000000..48cb665 --- /dev/null +++ b/src/models/darling.ts @@ -0,0 +1,11 @@ +import mongo from 'mongoose'; +const darlingSchema = new mongo.Schema({ + _id: mongo.Schema.Types.ObjectId, + username: String, + userID: String, + guildname: String, + guildID: String, + time: String +}); + +export = mongo.model('Darling', darlingSchema)
\ No newline at end of file |