Some bug fixes

This commit is contained in:
CorwinDev 2022-12-13 20:22:24 +01:00
parent 177f5f08a0
commit c9125a0111
15 changed files with 176 additions and 245 deletions

View file

@ -7,7 +7,7 @@ module.exports = async (client, interaction, args) => {
Schema.findOne({ Guild: interaction.guild.id, User: user.id }, async (err, data) => {
if (data) {
let money = parseInt(args[0]);
let money = parseInt(interaction.options.getNumber('amount'));
if (!money) return client.errUsage({ usage: "blackjack [amount]", type: 'editreply' }, interaction);
if (money > data.Money) return client.errNormal({ error: `You are betting more than you have!`, type: 'editreply' }, interaction);

View file

@ -4,142 +4,142 @@ const Schema = require("../../database/models/economy");
module.exports = async (client, interaction, args) => {
let user = interaction.user;
var result = Math.ceil(Math.random() * 12);
var result = Math.ceil(Math.random() * 12);
Schema.findOne({ Guild: interaction.guild.id, User: user.id }, async (err, data) => {
if (data) {
let money = parseInt(args[0]);
if (!money) return client.errUsage({ usage: "crash [amount]", type: 'editreply' }, interaction);
Schema.findOne({ Guild: interaction.guild.id, User: user.id }, async (err, data) => {
if (data) {
let money = parseInt(interaction.options.getNumber('amount'));
if (!money) return client.errUsage({ usage: "crash [amount]", type: 'editreply' }, interaction);
if (money > data.Money) return client.errNormal({ error: `You are betting more than you have!`, type: 'editreply' }, interaction);
if (money > data.Money) return client.errNormal({ error: `You are betting more than you have!`, type: 'editreply' }, interaction);
const row = new Discord.ActionRowBuilder()
.addComponents(
new Discord.ButtonBuilder()
.setCustomId('crash_stop')
.setEmoji("🛑")
.setStyle(Discord.ButtonStyle.Danger),
)
const row = new Discord.ActionRowBuilder()
.addComponents(
new Discord.ButtonBuilder()
.setCustomId('crash_stop')
.setEmoji("🛑")
.setStyle(Discord.ButtonStyle.Danger),
)
const disableRow = new Discord.ActionRowBuilder()
.addComponents(
new Discord.ButtonBuilder()
.setCustomId('crash_stop')
.setEmoji("🛑")
.setStyle(Discord.ButtonStyle.Danger)
.setDisabled(true),
)
const disableRow = new Discord.ActionRowBuilder()
.addComponents(
new Discord.ButtonBuilder()
.setCustomId('crash_stop')
.setEmoji("🛑")
.setStyle(Discord.ButtonStyle.Danger)
.setDisabled(true),
)
client.embed({
desc: `Crash started by ${user}・React 🛑 to stop`,
fields: [
{
name: `Multiplier`,
value: `1x`,
inline: true,
},
{
name: `Profit`,
value: `**0**`,
inline: true,
}
],
components: [row],
type: 'editreply'
}, interaction).then(msg => {
let multiplier = 1;
let index = 0;
client.embed({
desc: `Crash started by ${user}・React 🛑 to stop`,
fields: [
{
name: `Multiplier`,
value: `1x`,
inline: true,
},
{
name: `Profit`,
value: `**0**`,
inline: true,
}
],
components: [row],
type: 'editreply'
}, interaction).then(msg => {
let multiplier = 1;
let index = 0;
let times = result + 1;
let timer = 2000 * times;
let times = result + 1;
let timer = 2000 * times;
setInterval(() => {
if (index === result + 1) { return }
else if (index === result) {
setInterval(() => {
if (index === result + 1) { return }
else if (index === result) {
Schema.findOne({ Guild: interaction.guild.id, User: user.id }, async (err, data) => {
if (data) {
data.Money -= money;
data.save();
}
})
return client.embed({
title: `Crash Results of ${user}`,
desc: `${msg}`,
type: 'edit',
fields: [
{
name: `Loss`,
value: `**${money}**`,
inline: false,
}
]
}, msg)
}
else {
index += 1;
multiplier += 0.20;
let calc = money * multiplier;
let profit = calc - money;
client.embed({
desc: `Crash started by ${user}・React 🛑 to stop`,
type: 'edit',
fields: [
{
name: `Multiplier`,
value: `${multiplier.toFixed(1)}x`,
inline: true,
},
{
name: `Profit`,
value: `**$${profit.toFixed(2)}**`,
inline: true,
}
],
components: [row]
}, msg)
}
}, 2000)
const filter = i => i.user.id === interaction.user.id;
interaction.channel.awaitMessageComponent({ filter, max: 1, time: timer })
.then(async i => {
if (i.customId == "crash_stop") {
i.deferUpdate();
index = result + 1;
Schema.findOne({ Guild: interaction.guild.id, User: user.id }, async (err, data) => {
if (data) {
data.Money -= money;
data.Money += parseInt(profit);
data.save();
}
})
return client.embed({
title: `Crash Results of ${user}`,
desc: `${f} \n${msg}`,
desc: `Crash Results of ${user}`,
edit: true,
fields: [
{
name: `Loss`,
value: `**${money}**`,
inline: false,
}
]
}, msg)
}
else {
index += 1;
multiplier += 0.20;
let calc = money * multiplier;
let profit = calc - money;
client.embed({
desc: `Crash started by ${user}・React 🛑 to stop`,
edit: true,
fields: [
{
name: `Multiplier`,
value: `${multiplier.toFixed(1)}x`,
inline: true,
},
{
name: `Profit`,
value: `**$${profit.toFixed(2)}**`,
inline: true,
inline: false,
}
],
components: [row]
components: [disableRow]
}, msg)
const filter = i => i.user.id === interaction.user.id;
interaction.channel.awaitMessageComponent({ filter, max: 1, time: timer })
.then(async i => {
if (i.customId == "crash_stop") {
i.deferUpdate();
index = result + 1;
Schema.findOne({ Guild: interaction.guild.id, User: user.id }, async (err, data) => {
if (data) {
data.Money += parseInt(profit);
data.save();
}
})
return client.embed({
desc: `Crash Results of ${user}`,
edit: true,
fields: [
{
name: `Profit`,
value: `**$${profit.toFixed(2)}**`,
inline: false,
}
],
components: [disableRow]
}, msg)
}
})
}
}, 2000)
})
})
})
}
else {
client.errNormal({ error: `You has no ${client.emotes.economy.coins}!`, type: 'editreply' }, interaction);
}
})
}
else {
client.errNormal({ error: `You has no ${client.emotes.economy.coins}!`, type: 'editreply' }, interaction);
}
})
}

View file

@ -9,7 +9,7 @@ module.exports = async (client, interaction, args) => {
Schema.findOne({ Guild: interaction.guild.id, User: user.id }, async (err, data) => {
if (data) {
let money = parseInt(args[0]);
let money = parseInt(interaction.options.getNumber('amount'));
let win = false;
if (!money) return client.errUsage({ usage: "slots [amount]", type: 'editreply' }, interaction);

View file

@ -7,7 +7,7 @@ module.exports = async (client, interaction, args) => {
})
const output = new Discord.AttachmentBuilder(Buffer.from(list), { name: 'servers.txt'});
interaction.editreply({ files: [output] });
interaction.editReply({ files: [output] });
}

View file

@ -1,49 +0,0 @@
const Discord = require('discord.js');
const Schema = require('../../database/models/whitelist');
module.exports = async (client, interaction, args) => {
const type = interaction.options.getString('type');
const guild = interaction.options.getString('guild');
if (interaction.author.id === "534398298002292739") {
if (type == "add") {
Schema.findOne({ Guild: guild }, async (err, data) => {
if (data) {
data.Guild = guild;
data.save();
}
else {
new Schema({
Guild: guild
}).save();
}
})
client.succNormal({
text: `${guild} added to the bot whitelist`,
type: 'editreply'
}, interaction);
}
else if (type == "remove") {
Schema.findOne({ Guild: guild }, async (err, data) => {
if (data) {
Schema.findOneAndDelete({ Guild: guild }).then(() => {
client.succNormal({
text: `${guild} removed from the bot whitelist`,
type: 'editreply'
}, interaction);
})
}
})
}
}
else {
client.errNormal({
error: "Only the Bot CEO are allowed to do this",
type: 'editreply'
}, interaction);
}
}

View file

@ -2,21 +2,21 @@ const discord = require('discord.js');
module.exports = async (client, channel) => {
let types = {
GUILD_TEXT: "Text Channel",
GUILD_VOICE: "Voice Channel",
GUILD_CATEGORY: "Category",
UNKNOWN: "No Type",
GUILD_NEWS: "News Channel",
GUILD_STAGE_VOICE: "Stage Channel",
GUILD_STORE: "Store Channel",
GUILD_NEWS_THREAD: "News Thread",
GUILD_PUBLIC_THREAD: "Public Thread",
GUILD_PRIVATE_THREAD: "Private Thread",
0: "Text Channel",
2: "Voice Channel",
4: "Category",
5: "News Channel",
10: "News Thread",
11: "Public Thread",
12: "Private Thread",
13: "Stage Channel",
14: "Category",
}
const logsChannel = await client.getLogs(channel.guild.id);
if (!logsChannel) return;
console.log(channel.type)
client.embed({
title: `🔧・Channel created`,
desc: `A channel has been created`,

View file

@ -4,18 +4,17 @@ const ticketChannels = require("../../database/models/ticketChannels");
module.exports = async (client, channel) => {
let types = {
GUILD_TEXT: "Text Channel",
GUILD_VOICE: "Voice Channel",
GUILD_CATEGORY: "Category",
UNKNOWN: "No Type",
GUILD_NEWS: "News Channel",
GUILD_STAGE_VOICE: "Stage Channel",
GUILD_STORE: "Store Channel",
GUILD_NEWS_THREAD: "News Thread",
GUILD_PUBLIC_THREAD: "Public Thread",
GUILD_PRIVATE_THREAD: "Private Thread",
0: "Text Channel",
2: "Voice Channel",
4: "Category",
5: "News Channel",
10: "News Thread",
11: "Public Thread",
12: "Private Thread",
13: "Stage Channel",
14: "Category",
}
const logsChannel = await client.getLogs(channel.guild.id);
if (!logsChannel) return;

View file

@ -2,16 +2,15 @@ const discord = require('discord.js');
module.exports = async (client, channel, oldName, newName) => {
let types = {
GUILD_TEXT: "Text Channel",
GUILD_VOICE: "Voice Channel",
GUILD_CATEGORY: "Category",
UNKNOWN: "No Type",
GUILD_NEWS: "News Channel",
GUILD_STAGE_VOICE: "Stage Channel",
GUILD_STORE: "Store Channel",
GUILD_NEWS_THREAD: "News Thread",
GUILD_PUBLIC_THREAD: "Public Thread",
GUILD_PRIVATE_THREAD: "Private Thread",
0: "Text Channel",
2: "Voice Channel",
4: "Category",
5: "News Channel",
10: "News Thread",
11: "Public Thread",
12: "Private Thread",
13: "Stage Channel",
14: "Category",
}
const logsChannel = await client.getLogs(channel.guild.id);

View file

@ -2,16 +2,15 @@ const discord = require('discord.js');
module.exports = async (client, channel, time) => {
let types = {
GUILD_TEXT: "Text Channel",
GUILD_VOICE: "Voice Channel",
GUILD_CATEGORY: "Category",
UNKNOWN: "No Type",
GUILD_NEWS: "News Channel",
GUILD_STAGE_VOICE: "Stage Channel",
GUILD_STORE: "Store Channel",
GUILD_NEWS_THREAD: "News Thread",
GUILD_PUBLIC_THREAD: "Public Thread",
GUILD_PRIVATE_THREAD: "Private Thread",
0: "Text Channel",
2: "Voice Channel",
4: "Category",
5: "News Channel",
10: "News Thread",
11: "Public Thread",
12: "Private Thread",
13: "Stage Channel",
14: "Category",
}
const logsChannel = await client.getLogs(channel.guild.id);

View file

@ -2,16 +2,15 @@ const discord = require('discord.js');
module.exports = async (client, channel, oldTopic, newTopic) => {
let types = {
GUILD_TEXT: "Text Channel",
GUILD_VOICE: "Voice Channel",
GUILD_CATEGORY: "Category",
UNKNOWN: "No Type",
GUILD_NEWS: "News Channel",
GUILD_STAGE_VOICE: "Stage Channel",
GUILD_STORE: "Store Channel",
GUILD_NEWS_THREAD: "News Thread",
GUILD_PUBLIC_THREAD: "Public Thread",
GUILD_PRIVATE_THREAD: "Private Thread",
0: "Text Channel",
2: "Voice Channel",
4: "Category",
5: "News Channel",
10: "News Thread",
11: "Public Thread",
12: "Private Thread",
13: "Stage Channel",
14: "Category",
}
const logsChannel = await client.getLogs(channel.guild.id);

View file

@ -2,9 +2,9 @@ const discord = require('discord.js');
module.exports = async (client, channel) => {
let types = {
GUILD_NEWS_THREAD: "News Thread",
GUILD_PUBLIC_THREAD: "Public Thread",
GUILD_PRIVATE_THREAD: "Private Thread",
10: "News Thread",
11: "Public Thread",
12: "Private Thread",
}
const logsChannel = await client.getLogs(channel.guild.id);

View file

@ -2,9 +2,9 @@ const discord = require('discord.js');
module.exports = async (client, channel) => {
let types = {
GUILD_NEWS_THREAD: "News Thread",
GUILD_PUBLIC_THREAD: "Public Thread",
GUILD_PRIVATE_THREAD: "Private Thread",
10: "News Thread",
11: "Public Thread",
12: "Private Thread",
}
const logsChannel = await client.getLogs(channel.guild.id);

View file

@ -2,9 +2,9 @@ const discord = require('discord.js');
module.exports = async (client, oldChannel, newChannel) => {
let types = {
GUILD_NEWS_THREAD: "News Thread",
GUILD_PUBLIC_THREAD: "Public Thread",
GUILD_PRIVATE_THREAD: "Private Thread",
10: "News Thread",
11: "Public Thread",
12: "Private Thread",
}
const logsChannel = await client.getLogs(newChannel.guild.id);

View file

@ -308,7 +308,7 @@ module.exports = (client) => {
}).catch(e => { });
}
else {
return await interaction.send({
return await interaction.channel.send({
embeds: embeds,
content: content,
components: components,

View file

@ -74,21 +74,6 @@ module.exports = {
.setName('servers')
.setDescription('See all servers from this shard')
)
.addSubcommand(subcommand =>
subcommand
.setName('whitelist')
.setDescription('Manage the bot whitelist')
.addStringOption(option =>
option.setName('type')
.setDescription('The type of whitelist')
.setRequired(true)
.addChoices(
{ name: 'Add', value: 'add' },
{ name: 'Remove', value: 'remove' }
)
)
.addStringOption(option => option.setName('guild').setDescription('The ID of a guild').setRequired(true))
)
,
/**
@ -102,11 +87,10 @@ module.exports = {
if (data && data.FLAGS.includes("DEVELOPER")) {
client.loadSubcommands(client, interaction, args);
} else {
console.log(`[ERROR] >> Only Bot developers are allowed to do this`);
client.errNormal({
error: "Only Bot developers are allowed to do this",
type: 'reply'
}, interaction);
return client.errNormal({
error: 'Only Bot developers are allowed to do this',
type: 'editreply'
}, interaction)
}
})
},