mirror of
https://github.com/toast-ts/Daggerbot-TS.git
synced 2024-11-17 20:30:58 -05:00
This commit is contained in:
parent
aca2d449c6
commit
2beead7022
@ -28,12 +28,12 @@ const channels = {
|
||||
serverInfo: '543494084363288637',
|
||||
}
|
||||
export default class MP {
|
||||
static async autocomplete(client: TClient, interaction: Discord.AutocompleteInteraction<'cached'>) {
|
||||
static async autocomplete(client:TClient, interaction:Discord.AutocompleteInteraction<'cached'>) {
|
||||
const serversInCache = await client.MPServer?.findInCache();
|
||||
const filterByActive = serversInCache?.filter(x=>x.isActive)?.map(x=>x.serverName);
|
||||
await interaction?.respond(filterByActive?.map(server=>({name: server, value: server})));
|
||||
}
|
||||
static async run(client: TClient, interaction: Discord.ChatInputCommandInteraction<'cached'>) {
|
||||
static async run(client:TClient, interaction:Discord.ChatInputCommandInteraction<'cached'>) {
|
||||
if (client.config.botSwitches.mpSys === false) return interaction.reply({embeds: [mpModuleDisabled(client)]});
|
||||
if (client.uptime < refreshTimerSecs) return interaction.reply('MPModule isn\'t initialized yet, please wait a moment and try again.');
|
||||
if ([channels.mainMpChat, client.config.dcServer.channels.multifarm_chat].includes(interaction.channelId) && !MessageTool.isStaff(interaction.member) && ['status', 'players'].includes(interaction.options.getSubcommand())) return interaction.reply(`Please use <#${channels.activePlayers}> for \`/mp status/players\` commands to prevent clutter in this channel.`).then(()=>setTimeout(()=>interaction.deleteReply(), 6000));
|
||||
@ -77,6 +77,9 @@ export default class MP {
|
||||
if (!DSS) return console.log('Endpoint failed - details');
|
||||
const db = await client.MPServer.findInCache();
|
||||
const server = db.find(x=>x.serverName === choiceSelector);
|
||||
if (!server) return;
|
||||
// Shouldn't throw "Cannot read properties of undefined" error now,
|
||||
// but I hate people finding new ways to cause the bot to have a minor aneurysm
|
||||
|
||||
const dEmbed = new client.embed().setColor(client.config.embedColor).setAuthor({name: 'Crossplay server'}).setDescription(MessageTool.concatMessage(
|
||||
`**Name:** \`${DSS.server?.name.length > 0 ? DSS.server.name : '\u200b'}\``,
|
||||
|
Loading…
Reference in New Issue
Block a user