cleanup
This commit is contained in:
parent
1c9988fea6
commit
cfd5a2f59a
@ -52,6 +52,7 @@ class PollCommand extends SlashCommand {
|
||||
const { guild, subcommand, member, author } = invoker;
|
||||
|
||||
if (subcommand.name === 'create') {
|
||||
|
||||
await invoker.deferReply();
|
||||
const questions = [];
|
||||
|
||||
@ -111,21 +112,25 @@ class PollCommand extends SlashCommand {
|
||||
};
|
||||
|
||||
await guild.createPoll(poll);
|
||||
await invoker.editReply({ index: 'COMMAND_POLL_START', params: { channel: _channel.id } });
|
||||
await invoker.editReply({ emoji: 'success', index: 'COMMAND_POLL_START', params: { channel: _channel.id } });
|
||||
|
||||
} else if (subcommand.name === 'delete') {
|
||||
|
||||
const poll = guild.callbacks.find((cb) => cb.data.type === 'poll' && cb.data.message === message.value);
|
||||
if (!poll) return { index: 'COMMAND_POLL_404' };
|
||||
if (!poll) return { index: 'COMMAND_POLL_404', emoji: 'failure' };
|
||||
await guild.removeCallback(poll.id);
|
||||
const pollChannel = await guild.resolveChannel(poll.channel);
|
||||
const msg = await pollChannel.messages.fetch(poll.message).catch(() => null);
|
||||
if(msg) await msg.delete();
|
||||
return { index: 'COMMAND_POLL_DELETED', emoji: 'success' };
|
||||
|
||||
} else if (subcommand.name === 'end') {
|
||||
|
||||
const poll = guild.callbacks.find((cb) => cb.data.type === 'poll' && cb.data.message === message.value);
|
||||
if (!poll) return { index: 'COMMAND_POLL_404' };
|
||||
if (!poll) return { index: 'COMMAND_POLL_404', emoji: 'failure' };
|
||||
await guild._poll(poll.data);
|
||||
return { index: 'COMMAND_POLL_ENDED', emoji: 'success' };
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user