mirror of
https://github.com/toast-ts/Daggerbot-TS.git
synced 2024-11-17 04:10:59 -05:00
Relocate whitelist system
This commit is contained in:
parent
7f6fbfa93b
commit
1c05375a39
@ -4,7 +4,7 @@ import {writeFileSync} from 'node:fs';
|
||||
import path from 'node:path';
|
||||
export default {
|
||||
async run(client: TClient, interaction: Discord.ChatInputCommandInteraction<'cached'>){
|
||||
if (!client.isStaff(interaction.member) && !client.config.eval.whitelist.includes(interaction.member.id)) return client.youNeedRole(interaction, 'admin')
|
||||
if (!client.isStaff(interaction.member) && !client.config.whitelist.includes(interaction.member.id)) return client.youNeedRole(interaction, 'admin')
|
||||
const word = interaction.options.getString('word');
|
||||
const wordExists = await client.bannedWords._content.findById(word);
|
||||
({
|
||||
|
@ -22,10 +22,10 @@ const removeUsername = (text: string)=>{
|
||||
};
|
||||
export default {
|
||||
run(client: TClient, interaction: Discord.ChatInputCommandInteraction<'cached'>) {
|
||||
if (!client.config.eval.whitelist.includes(interaction.user.id)) return client.youNeedRole(interaction, 'bottech');
|
||||
if (!client.config.whitelist.includes(interaction.user.id)) return client.youNeedRole(interaction, 'bottech');
|
||||
({
|
||||
eval: async()=>{
|
||||
if (!client.config.eval.allowed) return interaction.reply({content: 'Eval is disabled.', ephemeral: true});
|
||||
if (!client.config.eval) return interaction.reply({content: 'Eval is currently disabled.', ephemeral: true});
|
||||
const code = interaction.options.getString('code') as string;
|
||||
let output = 'error';
|
||||
let error = false;
|
||||
|
@ -24,16 +24,14 @@
|
||||
],
|
||||
"status": "online"
|
||||
},
|
||||
"eval": {
|
||||
"allowed": true,
|
||||
"whitelist": [
|
||||
"190407856527376384",
|
||||
"615761944154210305",
|
||||
"633345781780185099",
|
||||
"215497515934416896",
|
||||
"309373272594579456"
|
||||
]
|
||||
},
|
||||
"eval": true,
|
||||
"whitelist": [
|
||||
"190407856527376384",
|
||||
"615761944154210305",
|
||||
"633345781780185099",
|
||||
"215497515934416896",
|
||||
"309373272594579456"
|
||||
],
|
||||
"mainServer": {
|
||||
"id": "468835415093411861",
|
||||
"staffRoles": [
|
||||
|
@ -6,7 +6,7 @@ export default {
|
||||
if (interaction.isChatInputCommand()){
|
||||
const commandFile = client.commands.get(interaction.commandName);
|
||||
console.log(client.logTime(), `${interaction.user.tag} used /${interaction.commandName} ${interaction.options.getSubcommand(false) ?? ''} in #${interaction.channel.name}`);
|
||||
if (!client.config.botSwitches.commands && !client.config.eval.whitelist.includes(interaction.user.id)) return interaction.reply({content: 'Bot is currently being run in development mode.', ephemeral: true});
|
||||
if (!client.config.botSwitches.commands && !client.config.whitelist.includes(interaction.user.id)) return interaction.reply({content: 'Bot is currently being run in development mode.', ephemeral: true});
|
||||
if (commandFile){
|
||||
try{
|
||||
commandFile.command.default.run(client, interaction);
|
||||
|
@ -114,7 +114,7 @@ export default {
|
||||
if (EveningArray.some(e=>message.content.toLowerCase().startsWith(e)) && message.channelId == GeneralChatID && message.type == 0) message.reply(`${EveningPhrases[Math.floor(Math.random()*EveningPhrases.length)]}`);
|
||||
if (NightArray.some(e=>message.content.toLowerCase().startsWith(e)) && message.channelId == GeneralChatID && message.type == 0) message.reply(`${NightPhrases[Math.floor(Math.random()*NightPhrases.length)]}`);
|
||||
// Failsafe thingy (Toastproof maybe)
|
||||
if (message.content.startsWith('!!_wepanikfrfr') && client.config.eval.whitelist.includes(message.author.id)) (client.guilds.cache.get(message.guildId) as Discord.Guild).commands.set(client.registry).then(()=>message.reply('How did you manage to lose the commands??? Anyways, it\'s re-registered now.')).catch((e:Error)=>message.reply(`Failed to deploy slash commands:\n\`\`\`${e.message}\`\`\``));
|
||||
if (message.content.startsWith('!!_wepanikfrfr') && client.config.whitelist.includes(message.author.id)) (client.guilds.cache.get(message.guildId) as Discord.Guild).commands.set(client.registry).then(()=>message.reply('How did you manage to lose the commands??? Anyways, it\'s re-registered now.')).catch((e:Error)=>message.reply(`Failed to deploy slash commands:\n\`\`\`${e.message}\`\`\``));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
7
src/typings/interfaces.d.ts
vendored
7
src/typings/interfaces.d.ts
vendored
@ -143,7 +143,8 @@ export interface Config {
|
||||
whitelistedServers: Array<string>,
|
||||
botSwitches: botSwitches,
|
||||
botPresence: Discord.PresenceData,
|
||||
eval: Eval,
|
||||
eval: boolean,
|
||||
whitelist: Array<string>
|
||||
mainServer: mainServer
|
||||
}
|
||||
interface botSwitches {
|
||||
@ -154,10 +155,6 @@ interface botSwitches {
|
||||
mpstats: boolean,
|
||||
autores: boolean
|
||||
}
|
||||
interface Eval {
|
||||
allowed: boolean,
|
||||
whitelist: Array<string>
|
||||
}
|
||||
interface mainServer {
|
||||
id: string,
|
||||
staffRoles: Array<string>,
|
||||
|
Loading…
Reference in New Issue
Block a user