Fixed some remaining changes from the transition to Slash commands

This commit is contained in:
ION606
2022-10-06 12:41:15 -04:00
parent b30fdc9e7f
commit d69e7e0479
12 changed files with 151 additions and 23 deletions
+3 -2
View File
@@ -5,7 +5,7 @@ module.exports = {
description: 'See where Selmer bot\'s code is stored!',
execute(interaction, Discord, Client, bot) {
const embd = new MessageEmbed()
.setAuthor({ name: "Selmer Bot", url: bot.inviteLink, iconURL: bot.user.displayAvatarURL() })
.setAuthor({ name: "Selmer Bot", url: bot.user.inviteLink, iconURL: bot.user.displayAvatarURL() })
.setThumbnail("https://github.com/ION606/selmer-bot-website/blob/main/assets/Selmer-icon.png?raw=true") // .setThumbnail('https://repository-images.githubusercontent.com/460670550/43932b23-d795-4334-838f-f33ee8f795c4')
.setDescription("Selmer Bot was created by ION606");
@@ -28,5 +28,6 @@ module.exports = {
]);
interaction.reply({ embeds: [embd], components: [row] });
}, options: []
}, options: [],
isDm: true
}
+2 -2
View File
@@ -7,7 +7,7 @@ const tutoText = [
"__**SETUP AND LOGGING**__\nSet up your server to take full advantage of Selmer Bot's features, this includes moderation logging, custom welcome messages, calendar event pings and more\n_Note: Most of these commands are only available to the server owner_\n\n__***COMMANDS***__\nsetup",
"__**ECONOMY**__\nThese commands have to do with the inventory and currency system Selmer Bot uses, although I should note that as of now Selmer Coin holds no IRL value ;-;\n\n__***COMMANDS***__\ninventory, buy, sell, shop, work, rank, balance",
"__**MODERATION**__\nI mean....\n\n***__COMMANDS__***\nhelp admin, warn, mute, unmute, kick, ban, unban, lock, unlock, serverlock\n\n__***NOTE:***__\nThe user needs to have either _kick_ or _ban_ permissions to use these",
"__**AMIME AND MANGA**__\nGet info on your favorite Anime or Manga as a stat-sheet, a fancy embed, or have Selmer Bot describe it to you\n__***COMMANDS***__\nasearch, msearch",
"__**AMIME AND MANGA**__\nGet info on your favorite Anime or Manga as a stat-sheet, a fancy embed, or have Selmer Bot describe it to you\n\n__***COMMANDS***__\nasearch, msearch",
"__**GAMES**__\nAt the moment Selmer Bot offers three games: Trivia, Tic Tac Toe, and Minesweeper. Both Trivia and Tic Tac Toe can be played with other people. Trivia and Minesweeper can also be played solo. Selmer Bot also has a battle game where you can use weapons, potions, attack and defend, but this is still in beta\n\n__***COMMANDS***__\nhelp game, game battle game tictactoe, game trivia, game equip, game status, game hp, game classes, game quit\n\n__**NOTE**__\nDue to how complicated this feature is, it will not be migrated to slash commands for now",
"__**SELMER SPECIFIC**__\nThese commands will probably be found nowhere else\nThese include quotes (For legal reasons I have to state they aren't real quotes, mostly), as well as varius other things I based on good old Selmer\n\n__***COMMANDS***__\narrow, extracredit, tuto, profile, quotes",
"__**MISCELLANEOUS**__\nThese are the commands that are not really in any of the other categories. Don't be fooled, these are actually some of the most useful commands Selmer Bot has to offer. From playing music to web scraping to memes, I'm sure Selmer Bot has what you're looking for\n\n__***COMMANDS***__\nhelp, kareoke, link, meme, pickupline, audio, react, scrape, stocks, crypto",
@@ -68,7 +68,7 @@ function postEmbd(bot, interaction, page, refered) {
if (page > 0 || refered) {
interaction.update({ content: '_Note: To see a full list of reminder stats visit www.selmerbot.com _', embeds: [te], components: [row] });
} else {
interaction.reply({ content: '_Note: To see a full list of reminder stats visit www.selmerbot.com _', embeds: [te], components: [row] });
interaction.channel.send({ content: '_Note: To see a full list of reminder stats visit www.selmerbot.com _', embeds: [te], components: [row] });
}
}
@@ -47,7 +47,7 @@ async function backupLists(bot, IDM) {
async function loadBotBackups(bot, IDM) {
try {
if (IDM) {
const botBackups = require('./backup.json').backups;
const botBackups = require('../admin/backup.json').backups;
bot.lockedChannels = objToMap(botBackups.locked);
} else {
bot.lockedChannels = objToMap(JSON.parse(botBackups.locked));
+4 -2
View File
@@ -27,10 +27,12 @@ function handle_dm(message, bot) {
handleInp(bot, message);
} else if (message.content.indexOf('!reminders') != -1) {
reminders.execute(message, null, null, null, bot);
} else if (message.content.indexOf('!repo') != -1 || message.content.indexOf('!code') != -1) {
repo.execute(message, null, null, null, bot);
}
// else if (message.content.indexOf('!repo') != -1 || message.content.indexOf('!code') != -1) {
// repo.execute(message, null, null, null, bot);
// }
else {
return message.reply('UNUSABLE DM COMMAND DETECTED');
}
+1 -1
View File
@@ -91,7 +91,7 @@ async function handle_interaction(interaction, mongouri, turnManager, bot, STATE
mswpr.handle(bot, interaction, interaction.channel, interaction.message, null, xp_collection);
} else if (interaction.customId.indexOf("sbtutorial") != -1) {
interaction.deferUpdate();
tuto.execute(interaction.message, null, null, null, bot);
tuto.execute(interaction, null, null, bot);
} //Button else ifs here
});
}
+11 -10
View File
@@ -18,10 +18,11 @@ getAllCoins();
module.exports = {
name: 'crypto',
description: 'Get the prices for most cryptocurrencies!',
async execute(message, args, Discord, Client, bot) {
if (args.length < 1 || args[0] == 'help') {
return message.reply("Please specify at least one cryptocurrency (_ex: !crypto BTC_) or list all currencies (_!crypto list_)");
} else if (args[0] == 'list') {
async execute(interaction, Discord, Client, bot) {
const args = interaction.options.data;
if (args.length < 1 || args[0].value == 'help') {
return interaction.reply("Please specify at least one cryptocurrency (_ex: !crypto BTC_) or list all currencies (_!crypto list_)");
} else if (args[0].value == 'list') {
try {
return new Promise((resolve, reject) => {
let temp = "```Name --> Symbol\n\n";
@@ -32,11 +33,11 @@ module.exports = {
resolve(temp);
}).then((temp) => {
message.reply(temp);
interaction.reply(temp);
})
} catch (err) {
console.error(err);
return message.reply("Uh Oh! There's been an error!");
return interaction.reply("Uh Oh! There's been an error!");
}
}
@@ -47,7 +48,7 @@ module.exports = {
var datacc = data.data.tickers.filter(t => t.target == 'USD');
const temp = datacc.filter(t => t.base == args[0]);
const temp = datacc.filter(t => t.base == args[0].value);
const res = temp.length == 0 ? [] : temp[0];
//price: res.last, symbol: base, trust score: trust_score
@@ -67,11 +68,11 @@ module.exports = {
.setTimestamp()
.setFooter({ text: 'Selmer Bot uses CoinGecko for cryptocurrency information'});
message.reply({ embeds: [embd] });
interaction.reply({ embeds: [embd] });
} catch (err) {
console.error(err);
return message.reply("Uh Oh! There's been an error!");
return interaction.reply("Uh Oh! There's been an error!");
}
},
options: [{name: 'qeury', description: 'Name or List', type: Constants.ApplicationCommandOptionTypes.STRING, required: true}]
options: [{name: 'query', description: 'Name or List', type: Constants.ApplicationCommandOptionTypes.STRING, required: true}]
}
+19
View File
@@ -1,6 +1,18 @@
const hastebin = require("hastebin-gen");
const { addComplaintButton } = require('../dev only/submitcomplaint');
const { Constants } = require('discord.js');
const { URL } = require("url");
function isValidUrl(s) {
try {
new URL(s);
return true;
} catch (err) {
return false;
}
};
module.exports ={
name: "scrape",
@@ -9,6 +21,13 @@ module.exports ={
const axios = require('axios');
// const cheerio = require('cheerio');
const url = interaction.options.data[0].value;
if (!isValidUrl(url)) {
return interaction.reply("Please enter a valid url").catch((err) => {
interaction.channel.send("Please enter a valid url");
});
}
axios(url)
.then(async response => {
const html = response.data;
+1 -1
View File
@@ -404,7 +404,7 @@ module.exports = {
);
}
return interaction.reply({ content: 'Please select an action\n_Notes: Adding offset to an event is only supported on the website and personal reminders can be viewed in DM\'s_', components: [row] });
return interaction.reply({ content: 'Please select an action\n_Notes: Adding offset to an event is only supported on the website and personal reminders can be viewed in DM\'s_', components: [row], ephemeral: true });
} else {
interaction.reply("You have to be a premium subscriber to use this feature!\n_support coming soon_");
}
+1 -1
View File
@@ -14,7 +14,7 @@ const { handle_dm } = require('./commands/dm_handler');
const { devCheck } = require('./commands/dev only/devcheck.js');
const { moderation_handler } = require('./commands/admin/moderation.js');
const { registerCommands } = require('./registerCommands.js');
const { backupLists, loadBotBackups } = require('./commands/admin/backupBot.js');
const { backupLists, loadBotBackups } = require('./commands/dev only/backupBot.js');
const { setPresence } = require('./commands/dev only/setPresence.js');
const { exit } = require('process');
//#endregion
+105
View File
@@ -22,6 +22,7 @@
"cheerio": "^1.0.0-rc.10",
"coingecko-api": "^1.0.10",
"cors": "^2.8.5",
"cozy-ical": "^1.1.22",
"date-fns": "^2.29.2",
"date-fns-timezone": "^0.1.4",
"discord-reply": "^0.1.2",
@@ -1022,6 +1023,14 @@
"resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz",
"integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ=="
},
"node_modules/byline": {
"version": "4.2.1",
"resolved": "https://registry.npmjs.org/byline/-/byline-4.2.1.tgz",
"integrity": "sha512-TpRoV4f+nCiSpg46GzGnJ6QeLjuTr/Tx5xHhf9BllruZZ01HoK9N7NSlbWeDugJHEwqrAw8UrhdIBFQf+QjGLQ==",
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/bytes": {
"version": "3.1.2",
"resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz",
@@ -1258,6 +1267,41 @@
"node": ">= 0.10"
}
},
"node_modules/cozy-ical": {
"version": "1.1.22",
"resolved": "https://registry.npmjs.org/cozy-ical/-/cozy-ical-1.1.22.tgz",
"integrity": "sha512-suMYKBI1mXvZbUIeXOed4WsJ6K4TI9U3NKAo9y8zE9EpOwhkitFB4os0MOKJvvWnUAQnkQC6dgFjNq6BHwIaAg==",
"dependencies": {
"byline": "4.2.1",
"extend": "3.0.0",
"moment-timezone": "0.5.3",
"printit": "0.1.19",
"rrule": "2.1.0",
"uuid": "2.0.1"
}
},
"node_modules/cozy-ical/node_modules/extend": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/extend/-/extend-3.0.0.tgz",
"integrity": "sha512-5mYyg57hpD+sFaJmgNL9BidQ5C7dmJE3U5vzlRWbuqG+8dytvYEoxvKs6Tj5cm3LpMsFvRt20qz1ckezmsOUgQ=="
},
"node_modules/cozy-ical/node_modules/moment-timezone": {
"version": "0.5.3",
"resolved": "https://registry.npmjs.org/moment-timezone/-/moment-timezone-0.5.3.tgz",
"integrity": "sha512-CruicnN/CSlOKDfyI+lQXZru32gIRGX1wF5PgW3sImRpAwo+kj/XkDVQ4shkU/GOcpigZUsJjOcBpuIZAqaROA==",
"dependencies": {
"moment": ">= 2.6.0"
},
"engines": {
"node": "*"
}
},
"node_modules/cozy-ical/node_modules/uuid": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-2.0.1.tgz",
"integrity": "sha512-nWg9+Oa3qD2CQzHIP4qKUqwNfzKn8P0LtFhotaCTFchsV7ZfDhAybeip/HZVeMIpZi9JgY1E3nUlwaCmZT1sEg==",
"deprecated": "Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details."
},
"node_modules/css-select": {
"version": "5.1.0",
"resolved": "https://registry.npmjs.org/css-select/-/css-select-5.1.0.tgz",
@@ -5764,6 +5808,14 @@
"node": ">=16.0.0"
}
},
"node_modules/printit": {
"version": "0.1.19",
"resolved": "https://registry.npmjs.org/printit/-/printit-0.1.19.tgz",
"integrity": "sha512-xCf0S6mzKZPSFn6/h+ULWvTnya39cjJlaRhYHdKNEUmLWmZYfhe6PTh5kMUncxNVLWHuqm5s4SdnIOlWfHkQCA==",
"engines": {
"node": "*"
}
},
"node_modules/prism-media": {
"version": "1.3.4",
"resolved": "https://registry.npmjs.org/prism-media/-/prism-media-1.3.4.tgz",
@@ -6109,6 +6161,11 @@
"uuid": "dist/bin/uuid"
}
},
"node_modules/rrule": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/rrule/-/rrule-2.1.0.tgz",
"integrity": "sha512-lsxjtdJHwHysRKxhBwHJk7IQqxGaNqEmd/KXzAjFPl+As17J9ixhVPjzbAsmknPuis2iP9BEEQeZwqEjOHvZeA=="
},
"node_modules/rss-parser": {
"version": "3.12.0",
"resolved": "https://registry.npmjs.org/rss-parser/-/rss-parser-3.12.0.tgz",
@@ -7866,6 +7923,11 @@
"resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz",
"integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ=="
},
"byline": {
"version": "4.2.1",
"resolved": "https://registry.npmjs.org/byline/-/byline-4.2.1.tgz",
"integrity": "sha512-TpRoV4f+nCiSpg46GzGnJ6QeLjuTr/Tx5xHhf9BllruZZ01HoK9N7NSlbWeDugJHEwqrAw8UrhdIBFQf+QjGLQ=="
},
"bytes": {
"version": "3.1.2",
"resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz",
@@ -8052,6 +8114,39 @@
"vary": "^1"
}
},
"cozy-ical": {
"version": "1.1.22",
"resolved": "https://registry.npmjs.org/cozy-ical/-/cozy-ical-1.1.22.tgz",
"integrity": "sha512-suMYKBI1mXvZbUIeXOed4WsJ6K4TI9U3NKAo9y8zE9EpOwhkitFB4os0MOKJvvWnUAQnkQC6dgFjNq6BHwIaAg==",
"requires": {
"byline": "4.2.1",
"extend": "3.0.0",
"moment-timezone": "0.5.3",
"printit": "0.1.19",
"rrule": "2.1.0",
"uuid": "2.0.1"
},
"dependencies": {
"extend": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/extend/-/extend-3.0.0.tgz",
"integrity": "sha512-5mYyg57hpD+sFaJmgNL9BidQ5C7dmJE3U5vzlRWbuqG+8dytvYEoxvKs6Tj5cm3LpMsFvRt20qz1ckezmsOUgQ=="
},
"moment-timezone": {
"version": "0.5.3",
"resolved": "https://registry.npmjs.org/moment-timezone/-/moment-timezone-0.5.3.tgz",
"integrity": "sha512-CruicnN/CSlOKDfyI+lQXZru32gIRGX1wF5PgW3sImRpAwo+kj/XkDVQ4shkU/GOcpigZUsJjOcBpuIZAqaROA==",
"requires": {
"moment": ">= 2.6.0"
}
},
"uuid": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-2.0.1.tgz",
"integrity": "sha512-nWg9+Oa3qD2CQzHIP4qKUqwNfzKn8P0LtFhotaCTFchsV7ZfDhAybeip/HZVeMIpZi9JgY1E3nUlwaCmZT1sEg=="
}
}
},
"css-select": {
"version": "5.1.0",
"resolved": "https://registry.npmjs.org/css-select/-/css-select-5.1.0.tgz",
@@ -11284,6 +11379,11 @@
"play-audio": "^0.5.2"
}
},
"printit": {
"version": "0.1.19",
"resolved": "https://registry.npmjs.org/printit/-/printit-0.1.19.tgz",
"integrity": "sha512-xCf0S6mzKZPSFn6/h+ULWvTnya39cjJlaRhYHdKNEUmLWmZYfhe6PTh5kMUncxNVLWHuqm5s4SdnIOlWfHkQCA=="
},
"prism-media": {
"version": "1.3.4",
"resolved": "https://registry.npmjs.org/prism-media/-/prism-media-1.3.4.tgz",
@@ -11550,6 +11650,11 @@
}
}
},
"rrule": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/rrule/-/rrule-2.1.0.tgz",
"integrity": "sha512-lsxjtdJHwHysRKxhBwHJk7IQqxGaNqEmd/KXzAjFPl+As17J9ixhVPjzbAsmknPuis2iP9BEEQeZwqEjOHvZeA=="
},
"rss-parser": {
"version": "3.12.0",
"resolved": "https://registry.npmjs.org/rss-parser/-/rss-parser-3.12.0.tgz",
+1
View File
@@ -13,6 +13,7 @@
"cheerio": "^1.0.0-rc.10",
"coingecko-api": "^1.0.10",
"cors": "^2.8.5",
"cozy-ical": "^1.1.22",
"date-fns": "^2.29.2",
"date-fns-timezone": "^0.1.4",
"discord-reply": "^0.1.2",
+2 -3
View File
@@ -17,9 +17,8 @@ function registerCommands(bot) {
key: code
*/
bot.commands.forEach((val, key) => {
if (val.options && val.name != 'econ') {
if (val.isDM) {
if ((val.options && val.name != 'econ') || val.isDm) {
if (val.isDm) {
commands.create({
name: val.name,
description: val.description,