diff options
| author | 8cy <[email protected]> | 2020-07-23 23:24:17 -0700 |
|---|---|---|
| committer | 8cy <[email protected]> | 2020-07-23 23:24:17 -0700 |
| commit | bb511abc03bb66848947e37a999502b813c77269 (patch) | |
| tree | 612c010fc8317e1cdf11471a18aad0270819d33e /src/bot.ts | |
| parent | fix: if clear amount equal or over 100, round down to 99 (diff) | |
| download | dep-core-bb511abc03bb66848947e37a999502b813c77269.tar.xz dep-core-bb511abc03bb66848947e37a999502b813c77269.zip | |
goodbye old uwufier :cry:
Diffstat (limited to 'src/bot.ts')
| -rw-r--r-- | src/bot.ts | 207 |
1 files changed, 0 insertions, 207 deletions
diff --git a/src/bot.ts b/src/bot.ts deleted file mode 100644 index 658f263..0000000 --- a/src/bot.ts +++ /dev/null @@ -1,207 +0,0 @@ -import config from './config.json'; // Import config -import { CommandoClient } from 'discord.js-commando'; - -//import WS from './server'; - -// Import MongoDB database models -import Welcome from './models/welcome.js'; -import Goodbye from './models/goodbye.js'; -import Verify from './models/Verify'; - -// Connect to database -import mongoose from 'mongoose'; -mongoose.connect(config['mongodburi'], { useNewUrlParser: true, useUnifiedTopology: true }) - -import path from 'path'; -// @ts-ignore emoji-random doesn't have types -import emoji from 'emoji-random'; -import { MessageEmbed } from 'discord.js'; - -// Import music functions -require('./models/MusicGuild.js') - -// Register client with basic information -const client = new CommandoClient({ - commandPrefix: 'uwu!', - owner: '217348698294714370', - invite: 'https://discord.gg/DVwXUwx' -}); - -// Make webserver public -//const ws = new WS(process.env.PORT, client) - -// Register more client information -client.registry - .registerDefaultTypes() - .registerGroups([ - ['fun', 'Fun Command Group'], - ['moderation', 'Moderation Command Group'], - ['server', 'Server Command Group'], - ['voice', 'Voice Command Group'], - ['nsfw', 'NSFW Command Group'], - ['anime', 'Anime Command Group'], - ['crypto', 'Crypto Command Group'], - ['zerotwo', 'Zero Two Command Group'], - ['bot', 'Bot Command Group'], - ['user', 'User Command Group'], - ['utility', 'Utility Command Group'], - ['minecraft', 'Minecraft Command Group'], - ['animals', 'Animal Command Group'], - ['roleplay', 'Roleplay Command Group'], - ['emma', 'Emma\'s Command Group'] - ]) - .registerDefaultGroups() - .registerDefaultCommands({ - help: true, - //eval: false - }) - .registerCommandsIn(path.join(__dirname, 'commands')); - -client.once('ready', async () => { - // Console out basic bot information - //console.log(`Started bot: ${client.user.tag} (ID: ${client.user.id})\nCurrently running on ${client.guilds.cache.size} server(s).`); - console.log('\x1b[0m' + 'Bot online!') - console.log('\x1b[31m' + ` _ _ __ _ -| | | | / _(_) -| | | |_ ___ _| |_ _ ___ _ __ -| | | \\ \\ /\\ / / | | | _| |/ _ \\ '__| -| |_| |\\ V V /| |_| | | | | __/ | - \\___/ \\_/\\_/ \\__,_|_| |_|\\___|_| - - `) - console.log('\x1b[0m' + 'discord.js Version: ' + '\x1b[36m' + '2.11') - console.log('\x1b[0m' + 'Node.js Version: ' + '\x1b[36m' + process.version) - console.log('\x1b[0m' + 'OS Version: ' + '\x1b[36m' + process.platform) - console.log('\x1b[0m' + 'Name: ' + '\x1b[36m' + `${client.user?.tag}`) - console.log('\x1b[0m' + 'ID: ' + '\x1b[36m' + `${client.user?.id}`) - console.log('\x1b[0m' + 'Servers: ' + '\x1b[36m' + `${client.guilds.cache.size}` + '\x1b[0m') - console.log() - - // Set status - // i would use a set interval in the main msg body but this is better for now because during maintenance you tend to refresh refresh a lot - // kinda crap if you forget to change uppity's status off of maintainence... 2020/05/05, 17:29 - if ((await client.users.fetch('705537104339402815')).presence.activities[0].name == 'maintenance') { - client.user?.setActivity('uwu!help | Maintenance', { - type: 'WATCHING' - }); - } else { - client.user?.setActivity('uwu!help | v' + config['version'], { - type: 'WATCHING' - }); - } -}); - -// Debug stuff -client.on('error', console.error); -//client.on('debug', console.debug); -client.on('warn', console.warn) - -// Logging information -client.on('guildCreate', guild => { - console.log(`Joined server: ${guild.name}`) - let embed = new MessageEmbed() - .setDescription(`Hi! Thank you for inviting uwufier to your server! To view the complete list of commands, do \`uwu!help\`. If you want to contact the lead developer for possible suggestions or to report a bug, please join the [support server](https://discord.com/invite/DVwXUwx). You can also do \`uwu!suggest<thing>\`. If you like the bot, please support the bot on our [top.gg page](https://top.gg/bot/699473263998271489/vote) or our [DBL page](https://discordbotlist.com/bots/699473263998271489/upvote)! ${emoji.random()}`) - guild.owner?.send(embed) - //@ts-ignore - client.guilds.cache.get('704032355987488791')?.channels.cache.get('706818034999754792')?.send(`Joined server: **${guild.name}**.`) -}) -client.on('guildDelete', guild => { - console.log(`Left server: ${guild.name}`) - //@ts-ignore - client.guilds.cache.get('704032355987488791')?.channels.cache.get('706818034999754792')?.send(`Joined server: **${guild.name}**.`) -}) - -client.on('guildMemberAdd', async member => { - /* if (member.guild.id.toString() == '663964105983393793') { - const captchaKey = Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15); - const emmaServer = 663964105983393793; - const unverRole = '729928740359897101'; - member.roles.add(unverRole); - const verify = new Verify({ - _id: mongoose.Types.ObjectId(), - username: member.user.username, - userID: member.user.id, - status: false, - key: captchaKey - }) - await verify.save() - .then(result => console.log(result)) - .catch(err => console.log(err)) - //@ts-ignore - member.send(`Please type \`uwu!verify ${captchaKey}\` to be verified.`) - // member.guild.channels.cache.get('729931444008517762')?.send(`Please send the message; \`uwu!verify ${captchaKey}\` to the server channel; \`#verification\` in order to be verified. ${emoji.random()}`); - } */ - - // Execute welcome command if present - Welcome.findOne({ guildID: member.guild.id }, async (error, guild) => { - if (error) { - console.log(error) - } else if (!guild) { - return - } else if (guild) { - // @ts-ignore linting error shows that channelID doesnt exist when it does - member.guild.channels.cache.get(guild.channelID)?.send(`<@${member.id}> has joined the server! ${emoji.random()}`) - } else { - return - } - }) -}) -client.on('guildMemberRemove', member => { - // Execute goodbye command if present - Goodbye.findOne({ guildID: member.guild.id }, async (error, guild) => { - if (error) { - console.log(error) - } else if (!guild) { - return - } else if (guild) { - // @ts-ignore linting error shows that channelID doesnt exist when it does - member.guild.channels.cache.get(guild.channelID)?.send(`<@${member.id}> (**${member.user.tag ? member.user.tag : member.nickname}**) has left the server! ${emoji.random()}`).then(m => m.react('🇫')); - } else { - return - } - }) -}) - -// Just more logging stuff basically -client.on('message', async msg => { - const msgContent = msg.content.toLowerCase(); - // Check if the prefix is present in a string - function prefixCheck() { - // shorthand ? : if else doesn't work for some reason - if (msgContent.startsWith('uwu!')) - return true; - else - return false; - } - if (prefixCheck()) { - if (msg.channel.type == 'dm') { - console.log(msg.author.tag, 'says', msgContent, 'in a DM'); - //@ts-ignore - client.guilds.cache.get('704032355987488791')?.channels.cache.get('706818034999754792')?.send(`**${msg.author.tag}** says **${msgContent}** in a **DM.**`) - } else { - console.log(msg.member?.user.tag, 'says', msgContent, 'in #' + msg.channel.name + ' in ' + msg.guild?.name); - //@ts-ignore - client.guilds.cache.get('704032355987488791')?.channels.cache.get('706818034999754792')?.send(`**${msg.author.tag}** says **${msgContent}** in **#${msg.channel.name}** in **${msg.guild?.name}**.`) - } - } - - // If a message mentions everyone, react with a random emoji - if (msg.mentions.everyone) msg.react(emoji.random()); - - // If a message is in Kat's Korner and it mentions the word water, react with LizardsWater emoji. - if (msg.guild?.id == '663964105983393793') - if (msg.content.toLowerCase().includes("water") || msg.content.toLowerCase().includes("wader")) { - msg.react('733894420700594187') - msg.react('732062891162992720') - } - - // If message has ugycat then react with ugycat - if (msg.guild?.id == '663964105983393793') { - if (msg.content.toLowerCase().includes('ugy') || msg.content.toLowerCase().includes('ugly')) - msg.react('733301856054280253') - } -}); - -// Register client -client.login(config['secret']); -//client.login(config['secret-dev']); |