feat: use webhooks for logs when possible
This commit is contained in:
parent
1081d1b361
commit
55a39e0758
12 changed files with 318 additions and 29 deletions
39
backend/src/plugins/InternalPoster/InternalPosterPlugin.ts
Normal file
39
backend/src/plugins/InternalPoster/InternalPosterPlugin.ts
Normal file
|
@ -0,0 +1,39 @@
|
|||
import { PluginOptions, typedGuildCommand } from "knub";
|
||||
import { GuildPingableRoles } from "../../data/GuildPingableRoles";
|
||||
import { zeppelinGuildPlugin } from "../ZeppelinPluginBlueprint";
|
||||
import { ConfigSchema, InternalPosterPluginType } from "./types";
|
||||
import {
|
||||
getPhishermanDomainInfo,
|
||||
hasPhishermanMasterAPIKey,
|
||||
phishermanApiKeyIsValid,
|
||||
reportTrackedDomainsToPhisherman,
|
||||
} from "../../data/Phisherman";
|
||||
import { mapToPublicFn } from "../../pluginUtils";
|
||||
import { Webhooks } from "../../data/Webhooks";
|
||||
import { Queue } from "../../Queue";
|
||||
import { sendMessage } from "./functions/sendMessage";
|
||||
|
||||
const defaultOptions: PluginOptions<InternalPosterPluginType> = {
|
||||
config: {},
|
||||
overrides: [],
|
||||
};
|
||||
|
||||
export const InternalPosterPlugin = zeppelinGuildPlugin<InternalPosterPluginType>()({
|
||||
name: "internal_poster",
|
||||
showInDocs: false,
|
||||
|
||||
configSchema: ConfigSchema,
|
||||
defaultOptions,
|
||||
|
||||
// prettier-ignore
|
||||
public: {
|
||||
sendMessage: mapToPublicFn(sendMessage),
|
||||
},
|
||||
|
||||
async beforeLoad(pluginData) {
|
||||
pluginData.state.webhooks = new Webhooks();
|
||||
pluginData.state.queue = new Queue();
|
||||
pluginData.state.missingPermissions = false;
|
||||
pluginData.state.webhookClientCache = new Map();
|
||||
},
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue