Fix error in AutoReactions error handling (yo dawg)
This commit is contained in:
parent
dbc083f6a9
commit
80b13fa20b
2 changed files with 6 additions and 2 deletions
|
@ -7,6 +7,7 @@ import { GuildSavedMessages } from "src/data/GuildSavedMessages";
|
|||
import { GuildAutoReactions } from "src/data/GuildAutoReactions";
|
||||
import { AddReactionsEvt } from "./events/AddReactionsEvt";
|
||||
import { trimPluginDescription } from "../../utils";
|
||||
import { LogsPlugin } from "../Logs/LogsPlugin";
|
||||
|
||||
const defaultOptions: PluginOptions<AutoReactionsPluginType> = {
|
||||
config: {
|
||||
|
@ -31,6 +32,7 @@ export const AutoReactionsPlugin = zeppelinPlugin<AutoReactionsPluginType>()("au
|
|||
`),
|
||||
},
|
||||
|
||||
dependencies: [LogsPlugin],
|
||||
configSchema: ConfigSchema,
|
||||
defaultOptions,
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@ import { autoReactionsEvt } from "../types";
|
|||
import { isDiscordRESTError } from "src/utils";
|
||||
import { LogType } from "src/data/LogType";
|
||||
import { logger } from "../../../logger";
|
||||
import { LogsPlugin } from "../../Logs/LogsPlugin";
|
||||
|
||||
export const AddReactionsEvt = autoReactionsEvt({
|
||||
event: "messageCreate",
|
||||
|
@ -23,12 +24,13 @@ export const AddReactionsEvt = autoReactionsEvt({
|
|||
`Could not apply auto-reaction to ${msg.channel.id}/${msg.id} in guild ${pluginData.guild.name} (${pluginData.guild.id}) (error code ${e.code})`,
|
||||
);
|
||||
|
||||
const logs = pluginData.getPlugin(LogsPlugin);
|
||||
if (e.code === 10008) {
|
||||
pluginData.state.logs.log(LogType.BOT_ALERT, {
|
||||
logs.log(LogType.BOT_ALERT, {
|
||||
body: `Could not apply auto-reactions in <#${msg.channel.id}> for message \`${msg.id}\`. Make sure nothing is deleting the message before the reactions are applied.`,
|
||||
});
|
||||
} else {
|
||||
pluginData.state.logs.log(LogType.BOT_ALERT, {
|
||||
logs.log(LogType.BOT_ALERT, {
|
||||
body: `Could not apply auto-reactions in <#${msg.channel.id}> for message \`${msg.id}\`. Error code ${e.code}.`,
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue