mirror of
https://github.com/ION606/selmerBot.git
synced 2026-05-15 05:36:54 +00:00
Transitioned all Misc, audio, Selmer Specific, admin, anime/manga, and inventory commands to Slash Command format. The RSS and reactionrole commands are still broken and all game commands are still in message format due to compications
This commit is contained in:
@@ -103,7 +103,7 @@ module.exports = {
|
||||
name: 'chat',
|
||||
description: 'chat',
|
||||
convoManager,
|
||||
execute(message, args, Discord, Client, bot) {
|
||||
message.reply("Please DM Selmer bot to use this command!");
|
||||
execute(interaction, args, Discord, Client, bot) {
|
||||
interaction.reply("Please DM Selmer bot to use this command!");
|
||||
}
|
||||
}
|
||||
@@ -365,21 +365,21 @@ function turnPage(bot, interaction) {
|
||||
module.exports = {
|
||||
name: "reminders",
|
||||
description: "Have Selmer Bot remind you - premium feature",
|
||||
execute(message, args, Discord, Client, bot) {
|
||||
execute(interaction, Discord, Client, bot) {
|
||||
//Check if the user has premium
|
||||
bot.mongoconnection.then(async (client) => {
|
||||
const dbo = client.db('main').collection('authorized');
|
||||
dbo.find({ discordID: message.author.id }).toArray((err, docs) => {
|
||||
dbo.find({ discordID: interaction.user.id }).toArray((err, docs) => {
|
||||
|
||||
//Only available to Selmer Bot devs, testers and "authorized" users
|
||||
if (docs[0] != undefined) {
|
||||
//Execute the command
|
||||
const row = new MessageActionRow()
|
||||
|
||||
if (message.channel.type == 'DM') {
|
||||
if (interaction.channel.type == 'DM') {
|
||||
row.addComponents(
|
||||
new MessageButton()
|
||||
.setCustomId(`newEvent|User|${message.author.id}`)
|
||||
.setCustomId(`newEvent|User|${interaction.user.id}`)
|
||||
.setLabel('New Personal Reminder')
|
||||
.setStyle('SUCCESS'),
|
||||
new MessageButton()
|
||||
@@ -390,7 +390,7 @@ module.exports = {
|
||||
} else {
|
||||
row.addComponents(
|
||||
new MessageButton()
|
||||
.setCustomId(`newEvent|User|${message.author.id}`)
|
||||
.setCustomId(`newEvent|User|${interaction.user.id}`)
|
||||
.setLabel('New Personal Reminder')
|
||||
.setStyle('SUCCESS'),
|
||||
new MessageButton()
|
||||
@@ -404,11 +404,12 @@ module.exports = {
|
||||
);
|
||||
}
|
||||
|
||||
return message.channel.send({ 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] });
|
||||
} else {
|
||||
message.reply("You have to be a premium subscriber to use this feature!\n_support coming soon_");
|
||||
interaction.reply("You have to be a premium subscriber to use this feature!\n_support coming soon_");
|
||||
}
|
||||
});
|
||||
});
|
||||
}, modalHandle, turnPage
|
||||
}, modalHandle, turnPage,
|
||||
options: []
|
||||
}
|
||||
+26
-22
@@ -3,9 +3,10 @@
|
||||
https://selmer-bot-listener.ion606.repl.co
|
||||
--------------------------------------------------
|
||||
*/
|
||||
//@ts-check
|
||||
|
||||
const { MongoClient, ServerApiVersion } = require('mongodb');
|
||||
const { MessageActionRow, MessageSelectMenu } = require('discord.js');
|
||||
const { MessageActionRow, MessageSelectMenu, Constants } = require('discord.js');
|
||||
const { addComplaintButton } = require('../dev only/submitcomplaint');
|
||||
|
||||
|
||||
@@ -79,10 +80,10 @@ async function createSubscriptionManual(bot, interaction, id, priceID) {
|
||||
}
|
||||
|
||||
|
||||
async function changeSubscriptionManual(bot, message) {
|
||||
async function changeSubscriptionManual(bot, interaction) {
|
||||
const stripe = bot.stripe;
|
||||
const mongouri = bot.mongouri;
|
||||
const id = message.author.id;
|
||||
const id = interaction.user.id;
|
||||
|
||||
//Just in case
|
||||
if (!id) { return console.log('....What? How?'); }
|
||||
@@ -102,7 +103,7 @@ async function changeSubscriptionManual(bot, message) {
|
||||
resolve(userID);
|
||||
} else {
|
||||
// client.close();
|
||||
reject(`No user with the ID of <@${message.author.id}>`);
|
||||
reject(`No user with the ID of <@${interaction.user.id}>`);
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -112,22 +113,22 @@ async function changeSubscriptionManual(bot, message) {
|
||||
customer: userID,
|
||||
return_url: "https://linktr.ee/selmerbot",
|
||||
}).then((session) => {
|
||||
message.reply(session.url);
|
||||
interaction.reply(session.url);
|
||||
})
|
||||
}).catch((err) => {
|
||||
|
||||
if (String(typeof(err)) == 'string') {
|
||||
message.reply(err);
|
||||
interaction.reply(err);
|
||||
} else {
|
||||
console.log(err);
|
||||
message.reply("A Stripe error occured! Please click the ✅ to report this ASAP!");
|
||||
addComplaintButton(bot, interaction.message);
|
||||
interaction.reply("A Stripe error occured! Please click the ✅ to report this ASAP!");
|
||||
addComplaintButton(bot, interaction.message); //?????????
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function createDropDown(bot, message) {
|
||||
function createDropDown(bot, interaction) {
|
||||
const stripe = bot.stripe;
|
||||
|
||||
const pl = [];
|
||||
@@ -144,7 +145,7 @@ function createDropDown(bot, message) {
|
||||
|
||||
let n = Promise.all(pl);
|
||||
let i = 0;
|
||||
n.then((t) => {
|
||||
n.then((t) => {
|
||||
t.forEach(data => {
|
||||
let price = data.unit_amount/100;
|
||||
vl[i].description = `The $${price} tier`;
|
||||
@@ -155,24 +156,25 @@ function createDropDown(bot, message) {
|
||||
const row = new MessageActionRow()
|
||||
.addComponents(
|
||||
new MessageSelectMenu()
|
||||
.setCustomId(`${message.author.id}|premium`)
|
||||
.setCustomId(`${interaction.user.id}|premium`)
|
||||
.setPlaceholder('Nothing selected')
|
||||
.addOptions(vl)
|
||||
);
|
||||
|
||||
message.channel.send({ content: `Please choose a tier`, components: [row] });
|
||||
interaction.reply({ content: `Please choose a tier`, components: [row], ephemeral: true });
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function handleInp(bot, message) {
|
||||
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);
|
||||
function handleInp(bot, interaction) {
|
||||
const inp = interaction.options.data[0];
|
||||
if (!inp || inp.value == 'help') {
|
||||
interaction.reply({content: '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/ *_', ephemeral: true});
|
||||
} else if (inp.value == 'buy') {
|
||||
createDropDown(bot, interaction);
|
||||
} else if (inp.value == 'manage') {
|
||||
changeSubscriptionManual(bot, interaction);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -180,7 +182,9 @@ function handleInp(bot, message) {
|
||||
module.exports = {
|
||||
name: 'premium',
|
||||
description: 'everything payment',
|
||||
execute(message, args, Discord, Client, bot) {
|
||||
message.reply("Please DM Selmer bot to use this command!");
|
||||
}, handleInp, createSubscriptionManual
|
||||
execute(interaction, Discord, Client, bot) {
|
||||
handleInp(bot, interaction);
|
||||
}, handleInp, createSubscriptionManual,
|
||||
options: [{name: 'input', description: 'What do you want to do?', type: Constants.ApplicationCommandOptionTypes.STRING, required: true, choices: [{name: 'help', value: 'help'}, {name: 'buy', value: 'buy'}, {name: 'manage', value: 'manage'}]}],
|
||||
isDM: true
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
|
||||
/**
|
||||
* Check if the user has a premium subscription
|
||||
* @param {*} bot
|
||||
* @param {String} userId
|
||||
* @returns {Promise<Boolean>}
|
||||
*/
|
||||
function verPremium(bot, userId) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const member = bot.guilds.cache.get(bot.home_server).members.cache.get(userId);
|
||||
bot.mongoconnection.then(async (client) => {
|
||||
const dbo = client.db('main').collection('authorized');
|
||||
dbo.findOne({ discordID: userId }).then((doc) => {
|
||||
//Only available to Selmer Bot devs, testers and "authorized" users
|
||||
if (doc != undefined || member && (member.roles.cache.has('944048889038774302') || member.roles.cache.has('946610800418762792'))) {
|
||||
resolve(true);
|
||||
} else {
|
||||
reject("You have to be a premium subscriber to use this feature!\n_support coming soon_");
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
module.exports = { verPremium }
|
||||
Reference in New Issue
Block a user