Added the ability to collect spam with a ommand, cleaned up the code and modified the LISCENCE.md file

This commit is contained in:
ION606
2022-07-08 17:09:36 +03:00
parent e03b689d6d
commit 919a7f62dc
7 changed files with 36 additions and 21 deletions
+2
View File
@@ -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
+1 -1
View File
@@ -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) => {
+7 -12
View File
@@ -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);
}
}
+4 -7
View File
@@ -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;
View File
+17
View File
@@ -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 }
+5 -1
View File
@@ -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; }