Skip to content

Commit

Permalink
Merge pull request #9 from Ezzud/update-v1.3.3
Browse files Browse the repository at this point in the history
Update v1.3.3
  • Loading branch information
Ezzud authored Apr 29, 2021
2 parents 1f5479d + 5756cd4 commit a212940
Show file tree
Hide file tree
Showing 29 changed files with 17,163 additions and 6,931 deletions.
81 changes: 68 additions & 13 deletions commands/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,37 @@ const moment = require('moment');
const fs = require('fs');
const low = require('lowdb');
const FileSync = require('lowdb/adapters/FileSync');

const db = require('quick.db')

module.exports.run = async (client, pf, message, args, manager,json,lang) => {

var adapting = new FileSync(`./data/${client.shard.ids[0]}/${message.guild.id}.json`);
var database = low(adapting);
var data = new db.table("serverInfo")
let embed = new Discord.MessageEmbed().setColor('E93C21').setAuthor(message.author.tag, message.author.avatarURL(), `https://github.com/Ezzud/tadaa`).setDescription(`${client.nope} ${lang.YouHaveNoPermission}`).setFooter(lang.footer.split("%version%").join(json.version))
if (!message.guild.member(message.author).hasPermission(8)) return (message.channel.send(embed));
if (!args[0]) {
let dmWin = await database.get(`data.isDMWin`).value()
let dmWin = await data.get(`${message.guild.id}.isDMWin`)
if (!dmWin) {
dmWin = true
await database.set(`data.isDMWin`, true).write()
await data.set(`${message.guild.id}.isDMWin`, true)
}
let rainbow = await data.get(`${message.guild.id}.rainbow`)
if(!rainbow) {
rainbow = false
await data.set(`${message.guild.id}.rainbow`, false)
}
let rainbowm;
if (rainbow === true) {
rainbowm = lang.activated
} else if (rainbow === false) {
rainbowm = lang.desactivated
} else {
rainbowm = `?`
}



let dmWinm;
if (dmWin === true) {
dmWinm = lang.activated
Expand All @@ -27,7 +44,9 @@ module.exports.run = async (client, pf, message, args, manager,json,lang) => {
} else {
dmWinm = `?`
}
let embed = new Discord.MessageEmbed().setAuthor(`Configuration`, message.guild.iconURL()).setThumbnail(client.user.avatarURL()).setDescription(`-> ${message.guild.name}`).setColor(`#5ED5F5`).addField(lang.configEmbedValues.split("%info%").join(client.info), lang.configEmbedField.split("%pf%").join(pf).split("%dmWinm%").join(dmWinm).split("%lang%").join(lang.name)).addField(lang.configEmbedChange.split("%what%").join(client.what), lang.configEmbedChangeField.split("%pf%").join(pf)).setFooter(lang.footer.split("%version%").join(json.version), message.author.avatarURL()).setTimestamp()


let embed = new Discord.MessageEmbed().setAuthor(`Configuration`, message.guild.iconURL()).setThumbnail(client.user.avatarURL()).setDescription(`-> ${message.guild.name}`).setColor(`#5ED5F5`).addField(lang.configEmbedValues.split("%info%").join(client.info), lang.configEmbedField.split("%pf%").join(pf).split("%dmWinm%").join(dmWinm).split("%lang%").join(lang.name).split("%rainbowm%").join(rainbowm)).addField(lang.configEmbedChange.split("%what%").join(client.what), lang.configEmbedChangeField.split("%pf%").join(pf)).setFooter(lang.footer.split("%version%").join(json.version), message.author.avatarURL()).setTimestamp()
message.channel.send(embed)
}
if (!args[0]) return;
Expand All @@ -37,7 +56,7 @@ module.exports.run = async (client, pf, message, args, manager,json,lang) => {
message.channel.send(embed)
return;
}
if (args[1] === await database.get(`data.prefix`).value()) {
if (args[1] === await data.get(`${message.guild.id}.prefix`)) {
let embed = new Discord.MessageEmbed().setColor('E93C21').setAuthor(message.author.tag, message.author.avatarURL(), `https://github.com/Ezzud/tadaa`).setDescription(lang.configPrefixSame.split("%nope%").join(client.nope)).addField(lang.configPrefixSyntaxTitle, lang.configPrefixSyntax.split("%pf%").join(pf)).setFooter(lang.footer.split("%version%").join(json.version))
message.channel.send(embed)
return;
Expand All @@ -47,8 +66,8 @@ module.exports.run = async (client, pf, message, args, manager,json,lang) => {
message.channel.send(embed)
return;
}
await database.set(`data.prefix`, args[1]).write()
let new_prefix = await database.get(`data.prefix`).value()
await data.set(`${message.guild.id}.prefix`, args[1])
let new_prefix = await data.get(`${message.guild.id}.prefix`)
let embed = new Discord.MessageEmbed().setColor('24E921').setAuthor(message.author.tag, message.author.avatarURL(), `https://github.com/Ezzud/tadaa`).setDescription(lang.configPrefixSuccess.split("%okay%").join(client.okay).split("%new_prefix%").join(new_prefix)).setFooter(lang.footer.split("%version%").join(json.version))
message.channel.send(embed)
} else if (args[0].toLowerCase() === 'dmwin') {
Expand All @@ -58,27 +77,63 @@ module.exports.run = async (client, pf, message, args, manager,json,lang) => {
return;
}
if (args[1].toLowerCase() === 'oui' || args[1].toLowerCase() === 'yes') {
if (await database.get(`data.isDMWin`).value() === true) {
if (await data.get(`${message.guild.id}.isDMWin`) === true) {
let embed = new Discord.MessageEmbed().setColor('E93C21').setAuthor(message.author.tag, message.author.avatarURL(), `https://github.com/Ezzud/tadaa`).setDescription(configDMWinAlreadyActivated.split("%nope%").join(client.nope)).addField(lang.configPrefixSyntaxTitle, lang.configDMWinSyntax.split("%pf%").join(pf)).setFooter(lang.footer.split("%version%").join(json.version))
message.channel.send(embed)
return;
}
await database.set(`data.isDMWin`, true).write()
await data.set(`${message.guild.id}.isDMWin`, true)
let embed = new Discord.MessageEmbed().setColor('24E921').setAuthor(message.author.tag, message.author.avatarURL(), `https://github.com/Ezzud/tadaa`).setDescription(lang.configDMWinActivated.split("%okay%").join(client.okay)).setFooter(lang.footer.split("%version%").join(json.version))
message.channel.send(embed)
} else if (args[1].toLowerCase() === 'non' || args[1].toLowerCase() === 'no') {
if (await database.get(`data.isDMWin`).value() === false) {
if (await data.get(`${message.guild.id}.isDMWin`) === false) {
let embed = new Discord.MessageEmbed().setColor('E93C21').setAuthor(message.author.tag, message.author.avatarURL(), `https://github.com/Ezzud/tadaa`).setDescription(lang.configDMWinAlreadyDesactivated.split("%nope%").join(client.nope)).addField(lang.configPrefixSyntaxTitle, lang.configDMWinSyntax.split("%pf%").join(pf)).setFooter(lang.footer.split("%version%").join(json.version))
message.channel.send(embed)
return;
}
await database.set(`data.isDMWin`, false).write()
await data.set(`${message.guild.id}.isDMWin`, false)
let embed = new Discord.MessageEmbed().setColor('24E921').setAuthor(message.author.tag, message.author.avatarURL(), `https://github.com/Ezzud/tadaa`).setDescription(lang.configDMWinDesactivated.split("%okay%").join(client.okay)).setFooter(lang.footer.split("%version%").join(json.version))
message.channel.send(embed)
} else {
let embed = new Discord.MessageEmbed().setColor('E93C21').setAuthor(message.author.tag, message.author.avatarURL(), `https://github.com/Ezzud/tadaa`).addField(lang.configPrefixSyntaxTitle, lang.configDMWinSyntax.split("%pf%").join(pf)).setFooter(lang.footer.split("%version%").join(json.version))
message.channel.send(embed)
}


} else if (args[0].toLowerCase() === 'rainbow') {
if (!args[1]) {
let embed = new Discord.MessageEmbed().setColor('E93C21').setAuthor(message.author.tag, message.author.avatarURL(), `https://github.com/Ezzud/tadaa`).setDescription(lang.configRainbowNoValue.split("%nope%").join(client.nope)).addField(lang.configPrefixSyntaxTitle, lang.configRainbowSyntax.split("%pf%").join(pf)).setFooter(lang.footer.split("%version%").join(json.version))
message.channel.send(embed)
return;
}
if (args[1].toLowerCase() === 'oui' || args[1].toLowerCase() === 'yes') {
if (await data.get(`${message.guild.id}.rainbow`) === true) {
let embed = new Discord.MessageEmbed().setColor('E93C21').setAuthor(message.author.tag, message.author.avatarURL(), `https://github.com/Ezzud/tadaa`).setDescription(ConfigRainbowAlreadyActivated.split("%nope%").join(client.nope)).addField(lang.configPrefixSyntaxTitle, lang.configRainbowSyntax.split("%pf%").join(pf)).setFooter(lang.footer.split("%version%").join(json.version))
message.channel.send(embed)
return;
}
await data.set(`${message.guild.id}.rainbow`, true)
let embed = new Discord.MessageEmbed().setColor('24E921').setAuthor(message.author.tag, message.author.avatarURL(), `https://github.com/Ezzud/tadaa`).setDescription(lang.configRainbowActivated.split("%okay%").join(client.okay)).setFooter(lang.footer.split("%version%").join(json.version))
message.channel.send(embed)
} else if (args[1].toLowerCase() === 'non' || args[1].toLowerCase() === 'no') {
if (await data.get(`${message.guild.id}.rainbow`) === false) {
let embed = new Discord.MessageEmbed().setColor('E93C21').setAuthor(message.author.tag, message.author.avatarURL(), `https://github.com/Ezzud/tadaa`).setDescription(lang.configRainbowAlreadyDesactivated.split("%nope%").join(client.nope)).addField(lang.configPrefixSyntaxTitle, lang.configRainbowSyntax.split("%pf%").join(pf)).setFooter(lang.footer.split("%version%").join(json.version))
message.channel.send(embed)
return;
}
await data.set(`${message.guild.id}.rainbow`, false)
let embed = new Discord.MessageEmbed().setColor('24E921').setAuthor(message.author.tag, message.author.avatarURL(), `https://github.com/Ezzud/tadaa`).setDescription(lang.configRainbowDesactivated.split("%okay%").join(client.okay)).setFooter(lang.footer.split("%version%").join(json.version))
message.channel.send(embed)
} else {
let embed = new Discord.MessageEmbed().setColor('E93C21').setAuthor(message.author.tag, message.author.avatarURL(), `https://github.com/Ezzud/tadaa`).addField(lang.configPrefixSyntaxTitle, lang.configRainbowSyntax.split("%pf%").join(pf)).setFooter(lang.footer.split("%version%").join(json.version))
message.channel.send(embed)
}






} else if(args[0].toLowerCase() === 'lang') {
client.langs = new Discord.Collection();
if(!args[1]) {
Expand All @@ -104,12 +159,12 @@ module.exports.run = async (client, pf, message, args, manager,json,lang) => {
});
let lang_file = client.langs.get(args[1]);
if(lang_file) {
if(lang_file.id === await database.get(`data.lang`).value()) {
if(lang_file.id === await data.get(`${message.guild.id}.lang`)) {
let embed = new Discord.MessageEmbed().setColor('E93C21').setAuthor(message.author.tag, message.author.avatarURL(), `https://github.com/Ezzud/tadaa`).setDescription(lang.configLangSame.split("%nope%").join(client.nope)).setFooter(lang.footer.split("%version%").join(json.version))
message.channel.send(embed)
return;
}
await database.set(`data.lang`, lang_file.id).write()
await data.set(`${message.guild.id}.lang`, lang_file.id)
let embed = new Discord.MessageEmbed().setColor('24E921').setAuthor(message.author.tag, message.author.avatarURL(), `https://github.com/Ezzud/tadaa`).setDescription(lang.configLangSuccess.split("%lang%").join(lang_file.name)).setFooter(lang.footer.split("%version%").join(json.version))
message.channel.send(embed)
return;
Expand Down
Loading

0 comments on commit a212940

Please sign in to comment.