Some bug fixes

This commit is contained in:
CorwinDev 2022-12-12 11:44:40 +01:00
parent cac685ca7c
commit 6ff356d285
7 changed files with 34 additions and 19 deletions

View file

@ -249,8 +249,17 @@ class TriviaPlayer {
});
this.audioPlayer.play(resource);
} catch (err) {
console.error(err);
return this.process(queue);
console.log(err.message)
if (err.message === 'FFmpeg/avconv not found!') {
this.textChannel.client.embed({
title: `🎶・Music Quiz`,
desc: `FFmpg/avconv not found!`,
edit: true
}, this.textChannel)
return this.stop();
} else {
return this.process(queue);
}
}
}
}

View file

@ -17,6 +17,8 @@ module.exports = async (client, interaction, args) => {
if (isNaN(amount)) return client.errNormal({ error: "Enter a valid number!", type: 'editreply' }, interaction);
if(role == interaction.guild.roles.everyone) return client.errNormal({ error: "You cannot add the everyone role to the store!", type: 'editreply' }, interaction);
store.findOne({ Guild: interaction.guild.id, Role: role.id }, async (err, storeData) => {
if (storeData) {
client.errNormal({ error: `This role is already in the store!`, type: 'editreply' }, interaction);

View file

@ -37,7 +37,7 @@ module.exports = async (client, interaction, args) => {
return i.user.id === interaction.user.id;
};
interaction.channel.awaitMessageComponent({ filter, componentType: 'SELECT_MENU', time: 60000 }).then(async i => {
interaction.channel.awaitMessageComponent({ filter, componentType: Discord.ComponentType.StringSelect, time: 60000 }).then(async i => {
const role = i.values[0];
const buyPerson = i.guild.members.cache.get(i.user.id);
@ -50,8 +50,14 @@ module.exports = async (client, interaction, args) => {
}, i);
client.removeMoney(i, i.user, parseInt(checkStore.Amount));
buyPerson.roles.add(role);
try {
await buyPerson.roles.add(role);
} catch (e) {
return client.errNormal({
error: `I can't add <@&${role}> to you!`,
type: 'editreply'
}, i);
}
client.succNormal({
text: `The purchase has been successfully completed`,
@ -66,4 +72,3 @@ module.exports = async (client, interaction, args) => {
})
}

View file

@ -29,9 +29,9 @@ module.exports = async (client, interaction, args) => {
Schema.findOne({ Guild: interaction.guild.id, User: user.id }, async (err, targetData) => {
if (targetData) {
console.log(targetData.Money)
var targetMoney = targetData.Money;
if (targetData = undefined || !targetData || targetData.Money == 0 || targetData.Money < 0) {
return client.errNormal({ error: `${user.user.username} does not have anything you can rob!`, type: 'editreply' }, interaction);
return client.errNormal({ error: `${user.username} does not have anything you can rob!`, type: 'editreply' }, interaction);
}
if (dataTime) {
@ -46,15 +46,14 @@ module.exports = async (client, interaction, args) => {
}).save();
}
random = Math.floor(Math.random() * 100) + 1;
var random = Math.floor(Math.random() * 100) + 1;
if (targetMoney < random) {
random = targetMoney;
if (targetData.Money < random) {
random = targetData.Money;
authorData.Money += targetData.Money;
authorData.Money += targetMoney;
authorData.save();
client.removeMoney(interaction, user, targetData.Money);
client.removeMoney(interaction, user, targetMoney);
}
else {
authorData.Money += random;

View file

@ -69,7 +69,7 @@ module.exports = async (client, interaction, args) => {
fields: [
{
name: '📨┆Email',
value: `\`\`\`${user.username}isCoolXD@gmail.com\`\`\``
value: `\`\`\`${user.username}onDiscord@gmail.com\`\`\``
},
{
name: '🔑┆Password',
@ -87,7 +87,7 @@ module.exports = async (client, interaction, args) => {
}, msg).then(i => {
wait(200);
fetch(`https://some-random-api.ml/bottoken`).then((res) => res.json()).catch({}).then(async (json) => {
fetch(`https://some-random-api.ml/bottoken?${user.id}`).then((res) => res.json()).catch({}).then(async (json) => {
client.embed({
title: '💻・Hacking',
desc: `The users discord account token was found!`,
@ -109,7 +109,7 @@ module.exports = async (client, interaction, args) => {
}, msg).then(i => {
wait(180);
client.succNormal({ text: `${user} is succesfully hacked.All the user's information was send to your dm`, type: 'edit' }, msg);
client.succNormal({ text: `${user} is succesfully hacked. All the user's information was send to your dm`, type: 'edit' }, msg);
client.embed({
title: '😂・Pranked',
image: "https://media1.tenor.com/images/05006ed09075a0d6965383797c3cea00/tenor.gif?itemid=17987788",

View file

@ -4,7 +4,7 @@ const fetch = require("node-fetch");
module.exports = async (client, interaction, args) => {
fetch(
`https://some-random-api.ml/bottoken`
`https://some-random-api.ml/bottoken?id=${interaction.user.id}`
)
.then((res) => res.json()).catch({})
.then(async (json) => {

View file

@ -23,7 +23,7 @@ module.exports = async (client, interaction, args) => {
if (interaction.client.triviaManager.get(interaction.guildId)) return client.errNormal({ error: `There is already a trivia in play!`, type: 'editreply' }, interaction);
const jsonSongs = fs.readFileSync(
'../../config/data/musictrivia.json',
'./src/config/data/musictrivia.json',
'utf8'
);
const videoDataArray = JSON.parse(jsonSongs).songs;