mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-14 13:55:03 +00:00
Fixes, refactoring and PR feedback
This commit is contained in:
parent
0be54912c4
commit
893a77d562
202 changed files with 1037 additions and 1069 deletions
|
@ -40,22 +40,22 @@ export const ResetCounterCmd = guildPluginMessageCommand<CountersPluginType>()({
|
|||
const counter = config.counters[args.counterName];
|
||||
const counterId = pluginData.state.counterIds[args.counterName];
|
||||
if (!counter || !counterId) {
|
||||
pluginData.getPlugin(CommonPlugin).sendErrorMessage(message, `Unknown counter: ${args.counterName}`);
|
||||
void pluginData.state.common.sendErrorMessage(message, `Unknown counter: ${args.counterName}`);
|
||||
return;
|
||||
}
|
||||
|
||||
if (counter.can_edit === false) {
|
||||
pluginData.getPlugin(CommonPlugin).sendErrorMessage(message, `Missing permissions to reset this counter's value`);
|
||||
void pluginData.state.common.sendErrorMessage(message, `Missing permissions to reset this counter's value`);
|
||||
return;
|
||||
}
|
||||
|
||||
if (args.channel && !counter.per_channel) {
|
||||
pluginData.getPlugin(CommonPlugin).sendErrorMessage(message, `This counter is not per-channel`);
|
||||
void pluginData.state.common.sendErrorMessage(message, `This counter is not per-channel`);
|
||||
return;
|
||||
}
|
||||
|
||||
if (args.user && !counter.per_user) {
|
||||
pluginData.getPlugin(CommonPlugin).sendErrorMessage(message, `This counter is not per-user`);
|
||||
void pluginData.state.common.sendErrorMessage(message, `This counter is not per-user`);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -64,13 +64,13 @@ export const ResetCounterCmd = guildPluginMessageCommand<CountersPluginType>()({
|
|||
message.channel.send(`Which channel's counter value would you like to reset?`);
|
||||
const reply = await waitForReply(pluginData.client, message.channel, message.author.id);
|
||||
if (!reply || !reply.content) {
|
||||
pluginData.getPlugin(CommonPlugin).sendErrorMessage(message, "Cancelling");
|
||||
void pluginData.state.common.sendErrorMessage(message, "Cancelling");
|
||||
return;
|
||||
}
|
||||
|
||||
const potentialChannel = pluginData.guild.channels.resolve(reply.content as Snowflake);
|
||||
if (!potentialChannel || !(potentialChannel instanceof TextChannel)) {
|
||||
pluginData.getPlugin(CommonPlugin).sendErrorMessage(message, "Channel is not a text channel, cancelling");
|
||||
void pluginData.state.common.sendErrorMessage(message, "Channel is not a text channel, cancelling");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -82,13 +82,13 @@ export const ResetCounterCmd = guildPluginMessageCommand<CountersPluginType>()({
|
|||
message.channel.send(`Which user's counter value would you like to reset?`);
|
||||
const reply = await waitForReply(pluginData.client, message.channel, message.author.id);
|
||||
if (!reply || !reply.content) {
|
||||
pluginData.getPlugin(CommonPlugin).sendErrorMessage(message, "Cancelling");
|
||||
void pluginData.state.common.sendErrorMessage(message, "Cancelling");
|
||||
return;
|
||||
}
|
||||
|
||||
const potentialUser = await resolveUser(pluginData.client, reply.content);
|
||||
if (!potentialUser || potentialUser instanceof UnknownUser) {
|
||||
pluginData.getPlugin(CommonPlugin).sendErrorMessage(message, "Unknown user, cancelling");
|
||||
void pluginData.state.common.sendErrorMessage(message, "Unknown user, cancelling");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue