diff --git a/LICENSE.md b/LICENSE.md index 4ea0309..23c708f 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -2,6 +2,8 @@ MIT License Copyright (c) 2021 ION606 +Find the original at https://github.com/ION606/selmerBot + Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights diff --git a/commands/API/chat.js b/commands/API/chat.js index 8415bc1..807bda2 100644 --- a/commands/API/chat.js +++ b/commands/API/chat.js @@ -3,7 +3,7 @@ const { exit } = require('process'); const { checkResponses } = require('./wordlist.js'); -//Error checking function (message deleted error fix) +//Error checking function (message deleted error fix, workaround already applied but...) //message.channel.send("Oops, there's been an error, please contact support!"); async function messageExists(message) { return new Promise((resolve, reject) => { diff --git a/commands/API/stripe.js b/commands/API/stripe.js index 86f9ed1..9519c37 100644 --- a/commands/API/stripe.js +++ b/commands/API/stripe.js @@ -1,5 +1,5 @@ /* ------WEBHOOKS ARE RECIEVED AND MONITORED HERE----- +-----WEBHOOKS ARE MONITORED AND PROCESSED HERE----- https://glitch.com/edit/#!/selmer-bot-listener -------------------------------------------------- */ @@ -13,7 +13,7 @@ async function createSubscriptionManual(bot, interaction, id, priceID) { const stripe = bot.stripe; const mongouri = bot.mongouri; - //Start Error Checking + //Error Checking (unlikely, but just in case) if (!id) { console.log('....What? How?'); return interaction.editReply("Uh oh, something happened with the Stripe Discord ID check, please contact support!"); } const client = new MongoClient(mongouri, { useNewUrlParser: true, useUnifiedTopology: true, serverApi: ServerApiVersion.v1 }); @@ -75,7 +75,7 @@ async function changeSubscriptionManual(bot, message) { const mongouri = bot.mongouri; const id = message.author.id; - //Start Error Checking + //Just in case if (!id) { return console.log('....What? How?'); } const client = new MongoClient(mongouri, { useNewUrlParser: true, useUnifiedTopology: true, serverApi: ServerApiVersion.v1 }); @@ -105,17 +105,13 @@ async function changeSubscriptionManual(bot, message) { return_url: "https://linktr.ee/selmerbot", }); message.reply(session.url); - // console.log(session.url); }).catch((err) => { message.reply(err); - // console.log(err); }); } -function createDropDown(bot, message) { - // const stripe = bot.stripe; - +function createDropDown(bot, message) { const stripe = bot.stripe; const pl = []; @@ -155,14 +151,13 @@ function createDropDown(bot, message) { function handleInp(bot, message) { - if (message.content == '!premium help') { - message.reply('Use _!premium buy_ to get premium or use _!premium manage_ to change or cancel your subscription\n_Disclaimer: Selmer Bot uses Stripe to manage payments. Read more at *https://stripe.com/ *_'); + if (message.content == '!premium' || message.content == '!premium help') { + message.reply('Use _!premium buy_ to get premium or use _!premium manage_ to change or cancel your subscription\n\n_Disclaimer: Selmer Bot uses Stripe to manage payments. Read more at *https://stripe.com/ *_'); } else if (message.content == '!premium buy') { createDropDown(bot, message); } else if (message.content == '!premium manage') { - changeSubscriptionManual(bot, message) + changeSubscriptionManual(bot, message); } - } diff --git a/commands/API/wordlist.js b/commands/API/wordlist.js index 8f93537..7aa452b 100644 --- a/commands/API/wordlist.js +++ b/commands/API/wordlist.js @@ -17,15 +17,12 @@ function checkResponses(convoOG, answer) { if (b === 'pay') { //Exctract the number - var amt = convoOG.match(/(\d+)/)[0]; + // var amt = convoOG.match(/(\d+)/)[0]; + // currency = convoOG[convoOG.indexOf(amt) - 1]; - - if (matches) { - currency = convoOG[convoOG.indexOf(amt) - 1]; - //Do something with pay API to get the amount here - } + return ('Use _!premium_ to get Selmer Bot Premium now!'); } else if (b == 'name') { - return 'My name is Selmer Bot!'; + return ('My name is Selmer Bot!'); } else { return null; } return b; diff --git a/commands/buttonhandler.js b/commands/buttonhandler.js deleted file mode 100644 index e69de29..0000000 diff --git a/commands/dev only/devcheck.js b/commands/dev only/devcheck.js new file mode 100644 index 0000000..10369e9 --- /dev/null +++ b/commands/dev only/devcheck.js @@ -0,0 +1,17 @@ +const { cleardb } = require('./spam_collection.js'); + +function devCheck(message, bot) { + const command = message.content.split(' ')[0].slice(1); + const args = message.content.split(' ')[1]; + const member = bot.guilds.cache.get(bot.home_server).members.cache.get(message.author.id); +console.log(command); + //Check if they have the "Selmer Dev" role + if (member.roles.cache.has('944048889038774302')) { + switch (command) { + case 'spam_collection': if (args[0] != undefined) { cleardb(args[0]); } + break; + } + } +} + +module.exports = { devCheck } \ No newline at end of file diff --git a/main.js b/main.js index 2e80d18..aec1537 100644 --- a/main.js +++ b/main.js @@ -10,6 +10,7 @@ const turnManager = require('./commands/turnManager.js'); const { welcome } = require('./commands/admin/welcome.js'); const { handle_interaction } = require('./commands/interactionhandler.js'); const { handle_dm } = require('./commands/dm_handler'); +const { devCheck } = require('./commands/dev only/devcheck.js'); const { exit } = require('process'); const BASE_LVL_XP = 20; @@ -237,7 +238,10 @@ bot.on('messageCreate', (message) => { //DM SECTION if (message.channel.type === "DM") { return handle_dm(message, bot); - } + } else if (message.content.indexOf('!spam_collection') != -1) { + //Handle spam collection/Dev commands + return devCheck(message, bot); + } //Special case, testing server (still need the emojis) if (!bot.inDebugMode && message.guild.id == bot.home_server) { return; }