diff options
Diffstat (limited to 'app_temp.js')
| -rw-r--r-- | app_temp.js | 143 |
1 files changed, 143 insertions, 0 deletions
diff --git a/app_temp.js b/app_temp.js new file mode 100644 index 0000000..abbb40a --- /dev/null +++ b/app_temp.js @@ -0,0 +1,143 @@ +const Discord = require('discord.js'); +const config = require('./config.json'); +const bot = new Discord.Client(); +const isImageUrl = require('is-image-url'); +const emoji = require('emoji-random'); +const atquotes = require('at-quotes'); +const ytdl = require('ytdl-core'); + +bot.on('ready', () => { + console.log(`Started bot: ${bot.user.tag} (ID: ${bot.user.id})\nCurrently running on ${bot.guilds.size} server(s).`); // Startup dialouge in output console + bot.user.setActivity('psycho~ uwu', { // Set status + type: 'LISTENING' + }); + + // Outputs available commands in output console + //commands = ['bot', 'help']; + //console.log(commands); +}); + +// Outputs errors in console window +bot.on('error', console.error); + +// Start Bot Commands +bot.on('message', async msg => { + //console.log(msg.content.toLowerCase()); + if (msg.channel.name === 'bots' || msg.channel.name === 'bot-commands' || msg.member.hasPermission('KICK_MEMBERS')) { + var msgContent = msg.content.toLowerCase(); + if (prefixCheck()) { + console.log(msg.member.user.tag, 'says', msgContent, 'in #' + msg.channel.name); + } + //console.log(config.prefixes.main); + + // Check prefixies in config.json + function prefixCheck() { + if (msgContent.startsWith(config.prefixes.main)) { + return "main"; + } else if (msgContent.startsWith(config.prefixes.alt)) { + return "alt1"; + } else if (msgContent.startsWith(config.prefixes.alt2)) { + return "alt2"; + } else if (msgContent.startsWith(config.prefixes.alt3)) { + return "alt3"; + } else if (msgContent.startsWith(config.prefixes.alt4)) { + return "alt4"; + } else if (msgContent.startsWith(config.prefixes.alt5)) { + return "alt5"; + } else if (msgContent.startsWith(config.prefixes.alt6)) { + return "alt6"; + } else if (msgContent.startsWith(config.prefixes.alt6b)) { + return "alt6b"; + } + } + + if (prefixCheck() == "main") { + var args = msg.content.slice(config.prefixes.main.length).split(/ +/); + var command = args.shift().toLowerCase(); + + if (msg.author.bot || !msg.content.startsWith(config.prefixes.main)) return; + } else if (prefixCheck() == "alt1") { + var args = msg.content.slice(config.prefixes.alt.length).split(/ +/); + var command = args.shift().toLowerCase(); + + if (msg.author.bot || !msg.content.startsWith(config.prefixes.alt)) return; + } else if (prefixCheck() == "alt2") { + var args = msg.content.slice(config.prefixes.alt2.length).split(/ +/); + var command = args.shift().toLocaleLowerCase(); + + if (msg.author.bot || !msg.content.startsWith(config.prefixes.alt2)) return; + } else if (prefixCheck() == "alt3") { + var args = msg.content.slice(config.prefixes.alt3.length).split(/ +/); + var command = args.shift().toLocaleLowerCase(); + + if (msg.author.bot || !msg.content.startsWith(config.prefixes.alt3)) return; + } else if (prefixCheck() == "alt4") { + var args = msg.content.slice(config.prefixes.alt4.length).split(/ +/); + var command = args.shift().toLocaleLowerCase(); + + if (msg.author.bot || !msg.content.startsWith(config.prefixes.alt4)) return; + } else if (prefixCheck() == "alt5") { + var args = msg.content.slice(config.prefixes.alt4.length).split(/ +/); + var command = args.shift().toLocaleLowerCase(); + + if (msg.author.bot || !msg.content.startsWith(config.prefixes.alt4)) return; + } else if (prefixCheck() == "alt6") { + var args = msg.content.slice(config.prefixes.alt4.length).split(/ +/); + var command = args.shift().toLocaleLowerCase(); + + if (msg.author.bot || !msg.content.startsWith(config.prefixes.alt4)) return; + } else if (prefixCheck() == "alt6b") { + var args = msg.content.slice(config.prefixes.alt4b.length).split(/ +/); + var command = args.shift().toLocaleLowerCase(); + + if (msg.author.bot || !msg.content.startsWith(config.prefixes.alt4b)) return; + } + + function noArgs() { + msg.channel.send(`invalid argument(s). type \`${config.prefixes.main}help\` for more information.`); + } + + function noCommand() { + msg.channel.send(`invalid or unspecified command. type \`${config.prefixes.main}help\`.`); + } + + function perms(p) { + if (msg.member.hasPermission(p)) return true; + } + + /*if (command == 'botstatus' || command == 'status' || command == 'bs') { + if (msg.member.hasPermission('KICK_MEMBERS')) { + if (!args) { + msg.reply('no status specified') + } + + if (args == 'online') { + bot.user.setStatus("online"); + } else if (args == 'idle') { + bot.user.setStatus("idle"); + } else if (args == 'dnd') { + bot.user.setStatus("dnd"); + } else if (args == 'invisable') { + bot.user.setStatus("invisable"); + } + } else { + msg.reply('insufficent perms bruh'); + } + }*/ + + /*function joinCheck() { + switch (msg.guild.voiceConnection) { + case !msg.guild.voiceConnection && msg.member.voiceChannel: + msg.member.voiceChannel.join(); + msg.reply('succesfully joined voice channel') + case (msg.guild.voiceConnection): + msg.reply('i\'m already in voice channel') + case (!msg.member.voiceChannel): + msg.reply('you\'re not in a voice channel') + } + }*/ + } else if (msg.channel.name !== 'bots' && msg.content.startsWith(`${config.prefixes.main}`) && !msg.member.hasPermission('KICK_MEMBERS')) return; +}) + +// Get bot token +bot.login(config['secret'])
\ No newline at end of file |