mirror of
https://github.com/toast-ts/Daggerbot-TS.git
synced 2024-11-18 04:40:59 -05:00
Merge 61eef3e21a
into 067cc33076
This commit is contained in:
commit
5f13d59121
@ -9,7 +9,7 @@ import util from 'node:util';
|
|||||||
import fs from 'node:fs';
|
import fs from 'node:fs';
|
||||||
export default class Developer {
|
export default class Developer {
|
||||||
static run(client: TClient, interaction: Discord.ChatInputCommandInteraction<'cached'>) {
|
static run(client: TClient, interaction: Discord.ChatInputCommandInteraction<'cached'>) {
|
||||||
if (!client.config.whitelist.includes(interaction.user.id)) return MessageTool.youNeedRole(interaction, 'bottech');
|
if (!client.config.whitelist.includes(interaction.member.id)) return MessageTool.isWhitelisted(interaction);
|
||||||
({
|
({
|
||||||
eval: async()=>{
|
eval: async()=>{
|
||||||
fs;
|
fs;
|
||||||
|
@ -118,7 +118,7 @@ export default class MP {
|
|||||||
},
|
},
|
||||||
maintenance: async()=>{
|
maintenance: async()=>{
|
||||||
if (client.config.dcServer.id === interaction.guildId) {
|
if (client.config.dcServer.id === interaction.guildId) {
|
||||||
if (!interaction.member.roles.cache.has(client.config.dcServer.roles.mpmod) && !interaction.member.roles.cache.has(client.config.dcServer.roles.bottech)) return MessageTool.youNeedRole(interaction, 'mpmod');
|
if (!interaction.member.roles.cache.has(client.config.dcServer.roles.mpmod) && !client.config.whitelist.includes(interaction.member.id)) return MessageTool.youNeedRole(interaction, 'mpmod');
|
||||||
}
|
}
|
||||||
|
|
||||||
const reason = interaction.options.getString('reason');
|
const reason = interaction.options.getString('reason');
|
||||||
@ -133,7 +133,7 @@ export default class MP {
|
|||||||
},
|
},
|
||||||
start: async()=>{
|
start: async()=>{
|
||||||
if (client.config.dcServer.id === interaction.guildId) {
|
if (client.config.dcServer.id === interaction.guildId) {
|
||||||
if (!interaction.member.roles.cache.has(client.config.dcServer.roles.mpmod) && !interaction.member.roles.cache.has(client.config.dcServer.roles.bottech)) return MessageTool.youNeedRole(interaction, 'mpmod');
|
if (!interaction.member.roles.cache.has(client.config.dcServer.roles.mpmod) && !client.config.whitelist.includes(interaction.member.id)) return MessageTool.youNeedRole(interaction, 'mpmod');
|
||||||
}
|
}
|
||||||
const map_names = interaction.options.getString('map_names', true).split('|');
|
const map_names = interaction.options.getString('map_names', true).split('|');
|
||||||
if (map_names.length > 10) return interaction.reply('You can only have up to 10 maps in a poll!');
|
if (map_names.length > 10) return interaction.reply('You can only have up to 10 maps in a poll!');
|
||||||
@ -150,7 +150,7 @@ export default class MP {
|
|||||||
},
|
},
|
||||||
end: async()=>{
|
end: async()=>{
|
||||||
if (client.config.dcServer.id === interaction.guildId) {
|
if (client.config.dcServer.id === interaction.guildId) {
|
||||||
if (!interaction.member.roles.cache.has(client.config.dcServer.roles.mpmod) && !interaction.member.roles.cache.has(client.config.dcServer.roles.bottech)) return MessageTool.youNeedRole(interaction, 'mpmod');
|
if (!interaction.member.roles.cache.has(client.config.dcServer.roles.mpmod) && !client.config.whitelist.includes(interaction.member.id)) return MessageTool.youNeedRole(interaction, 'mpmod');
|
||||||
}
|
}
|
||||||
const msg_id = interaction.options.getString('message_id', true);
|
const msg_id = interaction.options.getString('message_id', true);
|
||||||
const stripUrl = msg_id.replace(/https:\/\/discord.com\/channels\/\d+\/\d+\/(\d+)/, '$1');
|
const stripUrl = msg_id.replace(/https:\/\/discord.com\/channels\/\d+\/\d+\/(\d+)/, '$1');
|
||||||
@ -172,14 +172,14 @@ export default class MP {
|
|||||||
},
|
},
|
||||||
maps: async()=>{
|
maps: async()=>{
|
||||||
if (client.config.dcServer.id === interaction.guildId) {
|
if (client.config.dcServer.id === interaction.guildId) {
|
||||||
if (!interaction.member.roles.cache.has(client.config.dcServer.roles.mpmod) && !interaction.member.roles.cache.has(client.config.dcServer.roles.bottech)) return MessageTool.youNeedRole(interaction, 'mpmod');
|
if (!interaction.member.roles.cache.has(client.config.dcServer.roles.mpmod) && !client.config.whitelist.includes(interaction.member.id)) return MessageTool.youNeedRole(interaction, 'mpmod');
|
||||||
}
|
}
|
||||||
const suggestionPool = await (interaction.guild.channels.cache.get(client.config.dcServer.channels.mpmod_chat) as Discord.TextChannel).messages.fetch(MAP_POOL_HOOKMSG);
|
const suggestionPool = await (interaction.guild.channels.cache.get(client.config.dcServer.channels.mpmod_chat) as Discord.TextChannel).messages.fetch(MAP_POOL_HOOKMSG);
|
||||||
interaction.reply({embeds: [suggestionPool.embeds[0]]});
|
interaction.reply({embeds: [suggestionPool.embeds[0]]});
|
||||||
}, // Server management group
|
}, // Server management group
|
||||||
create_server: async()=>{
|
create_server: async()=>{
|
||||||
if (client.config.dcServer.id === interaction.guildId) {
|
if (client.config.dcServer.id === interaction.guildId) {
|
||||||
if (!interaction.member.roles.cache.has(client.config.dcServer.roles.mpmanager) && !interaction.member.roles.cache.has(client.config.dcServer.roles.bottech)) return MessageTool.youNeedRole(interaction, 'mpmanager');
|
if (!interaction.member.roles.cache.has(client.config.dcServer.roles.mpmanager) && !client.config.whitelist.includes(interaction.member.id)) return MessageTool.youNeedRole(interaction, 'mpmanager');
|
||||||
}
|
}
|
||||||
const dedicatedServerStatsURL = interaction.options.getString('dss-url');
|
const dedicatedServerStatsURL = interaction.options.getString('dss-url');
|
||||||
if (!dedicatedServerStatsURL) {
|
if (!dedicatedServerStatsURL) {
|
||||||
@ -201,7 +201,7 @@ export default class MP {
|
|||||||
},
|
},
|
||||||
remove_server: async()=>{
|
remove_server: async()=>{
|
||||||
if (client.config.dcServer.id === interaction.guildId) {
|
if (client.config.dcServer.id === interaction.guildId) {
|
||||||
if (!interaction.member.roles.cache.has(client.config.dcServer.roles.mpmanager) && !interaction.member.roles.cache.has(client.config.dcServer.roles.bottech)) return MessageTool.youNeedRole(interaction, 'mpmanager');
|
if (!interaction.member.roles.cache.has(client.config.dcServer.roles.mpmanager) && !client.config.whitelist.includes(interaction.member.id)) return MessageTool.youNeedRole(interaction, 'mpmanager');
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
Logger.console('log', logPrefix, `Removing "${choiceSelector}" from database`)
|
Logger.console('log', logPrefix, `Removing "${choiceSelector}" from database`)
|
||||||
@ -214,7 +214,7 @@ export default class MP {
|
|||||||
},
|
},
|
||||||
visibility_toggle: async()=>{
|
visibility_toggle: async()=>{
|
||||||
if (client.config.dcServer.id === interaction.guildId) {
|
if (client.config.dcServer.id === interaction.guildId) {
|
||||||
if (!interaction.member.roles.cache.has(client.config.dcServer.roles.mpmanager) && !interaction.member.roles.cache.has(client.config.dcServer.roles.bottech)) return MessageTool.youNeedRole(interaction, 'mpmanager');
|
if (!interaction.member.roles.cache.has(client.config.dcServer.roles.mpmanager) && !client.config.whitelist.includes(interaction.member.id)) return MessageTool.youNeedRole(interaction, 'mpmanager');
|
||||||
}
|
}
|
||||||
const toggleFlag = interaction.options.getBoolean('is_active');
|
const toggleFlag = interaction.options.getBoolean('is_active');
|
||||||
Logger.console('log', logPrefix, `Toggling isActive flag for "${choiceSelector}" to ${toggleFlag}`);
|
Logger.console('log', logPrefix, `Toggling isActive flag for "${choiceSelector}" to ${toggleFlag}`);
|
||||||
|
@ -14,7 +14,7 @@ export default class Suggest {
|
|||||||
},
|
},
|
||||||
delete: async()=>{
|
delete: async()=>{
|
||||||
if (client.config.dcServer.id === interaction.guildId) {
|
if (client.config.dcServer.id === interaction.guildId) {
|
||||||
if (!interaction.member.roles.cache.has(client.config.dcServer.roles.bottech)) return MessageTool.youNeedRole(interaction, 'bottech');
|
if (!client.config.whitelist.includes(interaction.member.id)) return MessageTool.isWhitelisted(interaction);
|
||||||
}
|
}
|
||||||
const sugg = await this.deleteSuggestion(client, idVal);
|
const sugg = await this.deleteSuggestion(client, idVal);
|
||||||
if (sugg) return interaction.reply(`Suggestion \`#${idVal}\` has been deleted.`);
|
if (sugg) return interaction.reply(`Suggestion \`#${idVal}\` has been deleted.`);
|
||||||
@ -22,7 +22,7 @@ export default class Suggest {
|
|||||||
},
|
},
|
||||||
update: async()=>{
|
update: async()=>{
|
||||||
if (client.config.dcServer.id === interaction.guildId) {
|
if (client.config.dcServer.id === interaction.guildId) {
|
||||||
if (!interaction.member.roles.cache.has(client.config.dcServer.roles.bottech)) return MessageTool.youNeedRole(interaction, 'bottech');
|
if (!client.config.whitelist.includes(interaction.member.id)) return MessageTool.isWhitelisted(interaction);
|
||||||
}
|
}
|
||||||
const status = interaction.options.getString('status', true);
|
const status = interaction.options.getString('status', true);
|
||||||
await this.updateSuggestion(client, idVal, status as 'Accepted'|'Rejected');
|
await this.updateSuggestion(client, idVal, status as 'Accepted'|'Rejected');
|
||||||
|
@ -61,7 +61,6 @@
|
|||||||
],
|
],
|
||||||
"roles": {
|
"roles": {
|
||||||
"admin": "468842789053136897",
|
"admin": "468842789053136897",
|
||||||
"bottech": "1011341005389307925",
|
|
||||||
"dcmod": "468841295150972929",
|
"dcmod": "468841295150972929",
|
||||||
"mpmanager": "1028735939813585029",
|
"mpmanager": "1028735939813585029",
|
||||||
"mpmod": "572151330710487041",
|
"mpmod": "572151330710487041",
|
||||||
|
@ -14,4 +14,5 @@ export default class MessageTool {
|
|||||||
public static isStaff =(guildMember:Discord.GuildMember)=>config.dcServer.staffRoles.map((x:string)=>config.dcServer.roles[x]).some((x:string)=>guildMember.roles.cache.has(x));
|
public static isStaff =(guildMember:Discord.GuildMember)=>config.dcServer.staffRoles.map((x:string)=>config.dcServer.roles[x]).some((x:string)=>guildMember.roles.cache.has(x));
|
||||||
public static youNeedRole =(interaction:Discord.CommandInteraction, role:keyof typeof config.dcServer.roles)=>interaction.reply(`You do not have ${this.formatMention(config.dcServer.roles[role], 'role')} role to use this command.`);
|
public static youNeedRole =(interaction:Discord.CommandInteraction, role:keyof typeof config.dcServer.roles)=>interaction.reply(`You do not have ${this.formatMention(config.dcServer.roles[role], 'role')} role to use this command.`);
|
||||||
public static isModerator =(guildMember:Discord.GuildMember)=>config.dcServer.staffRoles.filter((x:string)=>/^admin|^dcmod/.test(x)).map((x:string)=>config.dcServer.roles[x]).some((x:string)=>guildMember.roles.cache.has(x));
|
public static isModerator =(guildMember:Discord.GuildMember)=>config.dcServer.staffRoles.filter((x:string)=>/^admin|^dcmod/.test(x)).map((x:string)=>config.dcServer.roles[x]).some((x:string)=>guildMember.roles.cache.has(x));
|
||||||
|
public static isWhitelisted =(interaction:Discord.CommandInteraction)=>interaction.reply('You are not on whitelist!')
|
||||||
}
|
}
|
||||||
|
1
src/interfaces.d.ts
vendored
1
src/interfaces.d.ts
vendored
@ -136,7 +136,6 @@ export interface Config {
|
|||||||
staffRoles: string[],
|
staffRoles: string[],
|
||||||
roles: {
|
roles: {
|
||||||
admin: string,
|
admin: string,
|
||||||
bottech: string,
|
|
||||||
dcmod: string,
|
dcmod: string,
|
||||||
mpmanager: string,
|
mpmanager: string,
|
||||||
mpmod: string,
|
mpmod: string,
|
||||||
|
Loading…
Reference in New Issue
Block a user