mirror of
https://github.com/ION606/selmerBot.git
synced 2026-05-15 05:36:54 +00:00
Added the ability to collect spam with a ommand, cleaned up the code and modified the LISCENCE.md file
This commit is contained in:
@@ -2,6 +2,8 @@ MIT License
|
|||||||
|
|
||||||
Copyright (c) 2021 ION606
|
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
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
in the Software without restriction, including without limitation the rights
|
in the Software without restriction, including without limitation the rights
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ const { exit } = require('process');
|
|||||||
const { checkResponses } = require('./wordlist.js');
|
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!");
|
//message.channel.send("Oops, there's been an error, please contact support!");
|
||||||
async function messageExists(message) {
|
async function messageExists(message) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
|
|||||||
+7
-12
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
-----WEBHOOKS ARE RECIEVED AND MONITORED HERE-----
|
-----WEBHOOKS ARE MONITORED AND PROCESSED HERE-----
|
||||||
https://glitch.com/edit/#!/selmer-bot-listener
|
https://glitch.com/edit/#!/selmer-bot-listener
|
||||||
--------------------------------------------------
|
--------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@@ -13,7 +13,7 @@ async function createSubscriptionManual(bot, interaction, id, priceID) {
|
|||||||
const stripe = bot.stripe;
|
const stripe = bot.stripe;
|
||||||
const mongouri = bot.mongouri;
|
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!"); }
|
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 });
|
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 mongouri = bot.mongouri;
|
||||||
const id = message.author.id;
|
const id = message.author.id;
|
||||||
|
|
||||||
//Start Error Checking
|
//Just in case
|
||||||
if (!id) { return console.log('....What? How?'); }
|
if (!id) { return console.log('....What? How?'); }
|
||||||
|
|
||||||
const client = new MongoClient(mongouri, { useNewUrlParser: true, useUnifiedTopology: true, serverApi: ServerApiVersion.v1 });
|
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",
|
return_url: "https://linktr.ee/selmerbot",
|
||||||
});
|
});
|
||||||
message.reply(session.url);
|
message.reply(session.url);
|
||||||
// console.log(session.url);
|
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
message.reply(err);
|
message.reply(err);
|
||||||
// console.log(err);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function createDropDown(bot, message) {
|
function createDropDown(bot, message) {
|
||||||
// const stripe = bot.stripe;
|
|
||||||
|
|
||||||
const stripe = bot.stripe;
|
const stripe = bot.stripe;
|
||||||
|
|
||||||
const pl = [];
|
const pl = [];
|
||||||
@@ -155,14 +151,13 @@ function createDropDown(bot, message) {
|
|||||||
|
|
||||||
|
|
||||||
function handleInp(bot, message) {
|
function handleInp(bot, message) {
|
||||||
if (message.content == '!premium help') {
|
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_Disclaimer: Selmer Bot uses Stripe to manage payments. Read more at *https://stripe.com/ *_');
|
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') {
|
} else if (message.content == '!premium buy') {
|
||||||
createDropDown(bot, message);
|
createDropDown(bot, message);
|
||||||
} else if (message.content == '!premium manage') {
|
} else if (message.content == '!premium manage') {
|
||||||
changeSubscriptionManual(bot, message)
|
changeSubscriptionManual(bot, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -17,15 +17,12 @@ function checkResponses(convoOG, answer) {
|
|||||||
|
|
||||||
if (b === 'pay') {
|
if (b === 'pay') {
|
||||||
//Exctract the number
|
//Exctract the number
|
||||||
var amt = convoOG.match(/(\d+)/)[0];
|
// var amt = convoOG.match(/(\d+)/)[0];
|
||||||
|
// currency = convoOG[convoOG.indexOf(amt) - 1];
|
||||||
|
|
||||||
|
return ('Use _!premium_ to get Selmer Bot Premium now!');
|
||||||
if (matches) {
|
|
||||||
currency = convoOG[convoOG.indexOf(amt) - 1];
|
|
||||||
//Do something with pay API to get the amount here
|
|
||||||
}
|
|
||||||
} else if (b == 'name') {
|
} else if (b == 'name') {
|
||||||
return 'My name is Selmer Bot!';
|
return ('My name is Selmer Bot!');
|
||||||
} else { return null; }
|
} else { return null; }
|
||||||
|
|
||||||
return b;
|
return b;
|
||||||
|
|||||||
@@ -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 }
|
||||||
@@ -10,6 +10,7 @@ const turnManager = require('./commands/turnManager.js');
|
|||||||
const { welcome } = require('./commands/admin/welcome.js');
|
const { welcome } = require('./commands/admin/welcome.js');
|
||||||
const { handle_interaction } = require('./commands/interactionhandler.js');
|
const { handle_interaction } = require('./commands/interactionhandler.js');
|
||||||
const { handle_dm } = require('./commands/dm_handler');
|
const { handle_dm } = require('./commands/dm_handler');
|
||||||
|
const { devCheck } = require('./commands/dev only/devcheck.js');
|
||||||
const { exit } = require('process');
|
const { exit } = require('process');
|
||||||
const BASE_LVL_XP = 20;
|
const BASE_LVL_XP = 20;
|
||||||
|
|
||||||
@@ -237,7 +238,10 @@ bot.on('messageCreate', (message) => {
|
|||||||
//DM SECTION
|
//DM SECTION
|
||||||
if (message.channel.type === "DM") {
|
if (message.channel.type === "DM") {
|
||||||
return handle_dm(message, bot);
|
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)
|
//Special case, testing server (still need the emojis)
|
||||||
if (!bot.inDebugMode && message.guild.id == bot.home_server) { return; }
|
if (!bot.inDebugMode && message.guild.id == bot.home_server) { return; }
|
||||||
|
|||||||
Reference in New Issue
Block a user