Ignore this

This commit is contained in:
ION606
2022-10-24 11:01:24 -04:00
parent 4043038162
commit 8a47943764
2 changed files with 52 additions and 47 deletions
+1 -1
View File
@@ -53,7 +53,7 @@ async function loadBotBackups(bot, IDM) {
const botBackups = require('../admin/backup.json').backups; const botBackups = require('../admin/backup.json').backups;
bot.lockedChannels = objToMap(botBackups.locked); bot.lockedChannels = objToMap(botBackups.locked);
} else { } else {
bot.lockedChannels = objToMap(JSON.parse(botBackups.locked)); bot.lockedChannels = objToMap(JSON.parse(process.env.backupLists.locked));
} }
// bot.user.setActivity("RESTARTING BOT, PLEASE STAND BY.mp3", { type: "LISTENING" }); // User is....undefined???? // bot.user.setActivity("RESTARTING BOT, PLEASE STAND BY.mp3", { type: "LISTENING" }); // User is....undefined????
+48 -43
View File
@@ -9,7 +9,7 @@ const Stripe = require('stripe');
const turnManager = require('./commands/turnManager.js'); 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, handleContext } = 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 { devCheck } = require('./commands/dev only/devcheck.js');
const { moderation_handler } = require('./commands/admin/moderation.js'); const { moderation_handler } = require('./commands/admin/moderation.js');
@@ -174,58 +174,60 @@ let xp_collection = new Map();
let items; let items;
bot.on('ready', async () => { bot.on('ready', async () => {
registerCommands(bot); const startTime = new Date().getTime();
registerCommands(bot).then(() => {
//Make then copy the shop
bot.mongoconnection.then(client => {
const shop = client.db("main").collection("shop");
shop.find().toArray(function(err, itemstemp) {
if (err) throw err;
//Make then copy the shop items = [...itemstemp];
bot.mongoconnection.then(client => { });
const shop = client.db("main").collection("shop");
shop.find().toArray(function(err, itemstemp) {
if (err) throw err;
items = [...itemstemp];
bot.user.setStatus('online');
}); });
//Note the xp numbers are a little wonky on levels 6, 8 and 13 (why though?)
bot.user.setStatus('idle'); //See https://stackoverflow.com/questions/72212928/why-are-the-differences-between-my-numbers-inconsistent-sort-of-compund-interes
//Why doesn't this work? for (let i = 1; i < 101; i ++) {
// bot.user.setPresence({ // xp_collection.set(i, BASE_LVL_XP * .1);
// status: 'online', activity: { let amount = BASE_LVL_XP * (Math.ceil(Math.pow((1.1), (2 * i))) + i);
// name: "It's only logical!", xp_collection.set(i+1, amount);
// type: "LISTENING" }
// }
// });
});
//Note the xp numbers are a little wonky on levels 6, 8 and 13 (why though?)
//See https://stackoverflow.com/questions/72212928/why-are-the-differences-between-my-numbers-inconsistent-sort-of-compund-interes
for (let i = 1; i < 101; i ++) {
// xp_collection.set(i, BASE_LVL_XP * .1);
let amount = BASE_LVL_XP * (Math.ceil(Math.pow((1.1), (2 * i))) + i);
xp_collection.set(i+1, amount);
}
//Reaction map area //Reaction map area
if (!bot.inDebugMode) { if (!bot.inDebugMode) {
console.log('SLEEMER BOT ONLINE!!!!! OH MY GOD OH MY GOD!!!'); console.log('SLEEMER BOT ONLINE!!!!! OH MY GOD OH MY GOD!!!');
} else { } else {
console.log("Testing testing 1 2 5..."); console.log("Testing testing 1 2 5...");
} }
//Add the money symbol //Add the money symbol
let srv = bot.guilds.cache.get(bot.home_server).emojis.cache; let srv = bot.guilds.cache.get(bot.home_server).emojis.cache;
emj = srv.find((g) => { return g.name == 'selmer_coin' }); emj = srv.find((g) => { return g.name == 'selmer_coin' });
bot.currencysymbolmmain = `${emj}`; bot.currencysymbolmmain = `${emj}`;
}).catch((err) => {
console.log(err);
}).finally(() => { console.log(`Setting up Slash Commands took ${(new Date().getTime() - startTime) / 1000} seconds to complete!`); });
}); });
//Button Section //Button Section
bot.on('interactionCreate', async interaction => { bot.on('interactionCreate', async interaction => {
const { commandName } = interaction; const { commandName } = interaction;
// console.log(bot.lockedChannels); // console.log(bot.lockedChannels);
//Slash commands //Slash commands
if (interaction.isApplicationCommand()) { if (interaction.isApplicationCommand()) {
if (interaction.isUserContextMenu()) {
return handleContext(bot, interaction.options.data[0]);
}
const logable = ['kick', 'ban', 'unban', 'mute', 'unmute', 'timeout']; const logable = ['kick', 'ban', 'unban', 'mute', 'unmute', 'timeout'];
const econList = ["buy", 'shop', 'work', 'rank', 'inventory', 'balance', 'sell']; const econList = ["buy", 'shop', 'work', 'rank', 'inventory', 'balance', 'sell'];
const adminList = ["setpresence", "setactivity"]; const adminList = ["setpresence", "setactivity"];
@@ -242,8 +244,10 @@ bot.on('interactionCreate', async interaction => {
moderation_handler(bot, interaction, commandName); moderation_handler(bot, interaction, commandName);
} else if (econList.includes(commandName)) { } else if (econList.includes(commandName)) {
bot.commands.get('econ').execute(bot, interaction, Discord, mongouri, items, xp_collection); bot.commands.get('econ').execute(bot, interaction, Discord, mongouri, items, xp_collection);
} } else if (commandName == 'game') {
else if (bot.commands.has(commandName)) { return console.log(interaction);
bot.commands.get(bot, interaction, command, Discord, mongouri, items, xp_collection)
} else if (bot.commands.has(commandName)) {
bot.commands.get(commandName).execute(interaction, Discord, Client, bot); bot.commands.get(commandName).execute(interaction, Discord, Client, bot);
} else { } else {
interaction.reply("Unknown command detected!"); interaction.reply("Unknown command detected!");
@@ -268,16 +272,17 @@ bot.on("guildCreate", guild => {
//const role = guild.roles.cache.find((role) => role.name === 'Selmer Bot Mod'); // member.roles.cache.has('role-id-here'); //const role = guild.roles.cache.find((role) => role.name === 'Selmer Bot Mod'); // member.roles.cache.has('role-id-here');
const server = bot.guilds.cache.get(guild.id); const server = bot.guilds.cache.get(guild.id);
const owner = server.members.fetch(guild.ownerId).then(function(owner) { server.members.fetch(guild.ownerId).then(function(owner) {
owner.send('Thank you for adding Selmer Bot to your server!\nPlease give people you want to have access to Selmer Bot\'s restricted commands the "_Selmer Bot Commands_" role and people you want to access set the calendar the "Selmer Bot Calendar" role'); owner.send('Thank you for adding Selmer Bot to your server!\nPlease give people you want to have access to Selmer Bot\'s restricted commands the "_Selmer Bot Commands_" role and people you want to access set the calendar the "_Selmer Bot Calendar_" role');
owner.send('To help set up Selmer Bot to work better with your server, use _!setup help_ in a channel Selmer Bot is in!'); owner.send('To help set up Selmer Bot to work better with your server, use _/setup help_ in a channel Selmer Bot is in!');
}); });
//Set up the server //Set up the server
bot.mongoconnection.then(client => { bot.mongoconnection.then(client => {
const dbo = client.db(guild.id).collection('SETUP'); const dbo = client.db(guild.id).collection('SETUP');
dbo.insertMany([{_id: 'WELCOME', 'welcomechannel': null, 'welcomemessage': null, 'welcomebanner': null}, {_id: 'LOG', 'keepLogs': false, 'logchannel': null, 'severity': 0}, {_id: 'announcement', channel: null, role: null}]); dbo.insertMany([{_id: 'WELCOME', 'welcomechannel': null, 'welcomemessage': null, 'welcomebanner': null}, {_id: 'LOG', 'keepLogs': false, 'logchannel': null, 'severity': 0},
{_id: 'announcement', channel: null, role: null}, {_id: 'roles', commands: ["Selmer Bot Commands"], announcements: "Selmer Bot Calendar"}]);
}); });
}); });
@@ -337,7 +342,7 @@ bot.on('guildMemberAdd', async (member) => {
if (member.guild.id == bot.home_server && !bot.inDebugMode) { return; } if (member.guild.id == bot.home_server && !bot.inDebugMode) { return; }
//Check for impartial data //Check for impartial data
if(member.partial) await member.fetch(); if (member.partial) { member = await member.fetch(); }
const guild = bot.guilds.cache.get(member.guild.id); const guild = bot.guilds.cache.get(member.guild.id);