mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-14 13:55:03 +00:00
Added Discord attachment link reaction, fixed emoji configuration and moved util functions
This commit is contained in:
parent
a4c4b17a14
commit
592d037148
173 changed files with 1540 additions and 1170 deletions
|
@ -1,7 +1,7 @@
|
|||
import { guildPluginMessageCommand } from "knub";
|
||||
import { commandTypeHelpers as ct } from "../../../commandTypes";
|
||||
import { sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
|
||||
import { confirm, noop, trimMultilineString } from "../../../utils";
|
||||
import { CommonPlugin } from "../../Common/CommonPlugin";
|
||||
import { resetAllCounterValues } from "../functions/resetAllCounterValues";
|
||||
import { CountersPluginType } from "../types";
|
||||
|
||||
|
@ -18,17 +18,19 @@ export const ResetAllCounterValuesCmd = guildPluginMessageCommand<CountersPlugin
|
|||
const counter = config.counters[args.counterName];
|
||||
const counterId = pluginData.state.counterIds[args.counterName];
|
||||
if (!counter || !counterId) {
|
||||
sendErrorMessage(pluginData, message.channel, `Unknown counter: ${args.counterName}`);
|
||||
pluginData.getPlugin(CommonPlugin).sendErrorMessage(message, `Unknown counter: ${args.counterName}`);
|
||||
return;
|
||||
}
|
||||
|
||||
if (counter.can_reset_all === false) {
|
||||
sendErrorMessage(pluginData, message.channel, `Missing permissions to reset all of this counter's values`);
|
||||
pluginData
|
||||
.getPlugin(CommonPlugin)
|
||||
.sendErrorMessage(message, `Missing permissions to reset all of this counter's values`);
|
||||
return;
|
||||
}
|
||||
|
||||
const counterName = counter.name || args.counterName;
|
||||
const confirmed = await confirm(message.channel, message.author.id, {
|
||||
const confirmed = await confirm(message, message.author.id, {
|
||||
content: trimMultilineString(`
|
||||
Do you want to reset **ALL** values for counter **${counterName}**?
|
||||
This will reset the counter for **all** users and channels.
|
||||
|
@ -36,7 +38,7 @@ export const ResetAllCounterValuesCmd = guildPluginMessageCommand<CountersPlugin
|
|||
`),
|
||||
});
|
||||
if (!confirmed) {
|
||||
sendErrorMessage(pluginData, message.channel, "Cancelled");
|
||||
pluginData.getPlugin(CommonPlugin).sendErrorMessage(message, "Cancelled");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -47,7 +49,9 @@ export const ResetAllCounterValuesCmd = guildPluginMessageCommand<CountersPlugin
|
|||
await resetAllCounterValues(pluginData, args.counterName);
|
||||
|
||||
loadingMessage?.delete().catch(noop);
|
||||
sendSuccessMessage(pluginData, message.channel, `All counter values for **${counterName}** have been reset`);
|
||||
pluginData
|
||||
.getPlugin(CommonPlugin)
|
||||
.sendSuccessMessage(message, `All counter values for **${counterName}** have been reset`);
|
||||
|
||||
pluginData.getKnubInstance().reloadGuild(pluginData.guild.id);
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue