Automod work vol 3
This commit is contained in:
parent
0e9f65e0d5
commit
0f0728bc1c
18 changed files with 133 additions and 38 deletions
|
@ -1,7 +1,7 @@
|
|||
import { SavedMessage } from "../../../data/entities/SavedMessage";
|
||||
import { eventListener, PluginData } from "knub";
|
||||
import { eventListener } from "knub";
|
||||
import { AutomodContext, AutomodPluginType } from "../types";
|
||||
import { runAutomod } from "../functions/runAutomod";
|
||||
import { RecentActionType } from "../constants";
|
||||
|
||||
export const RunAutomodOnJoinEvt = eventListener<AutomodPluginType>()(
|
||||
"guildMemberAdd",
|
||||
|
@ -9,8 +9,19 @@ export const RunAutomodOnJoinEvt = eventListener<AutomodPluginType>()(
|
|||
const context: AutomodContext = {
|
||||
timestamp: Date.now(),
|
||||
user: member.user,
|
||||
member,
|
||||
joined: true,
|
||||
};
|
||||
|
||||
pluginData.state.queue.add(() => runAutomod(pluginData, context));
|
||||
pluginData.state.queue.add(() => {
|
||||
pluginData.state.recentActions.push({
|
||||
type: RecentActionType.MemberJoin,
|
||||
context,
|
||||
count: 1,
|
||||
identifier: null,
|
||||
});
|
||||
|
||||
runAutomod(pluginData, context);
|
||||
});
|
||||
},
|
||||
);
|
||||
|
|
|
@ -6,9 +6,14 @@ import { addRecentActionsFromMessage } from "../functions/addRecentActionsFromMe
|
|||
import moment from "moment-timezone";
|
||||
|
||||
export function runAutomodOnMessage(pluginData: PluginData<AutomodPluginType>, message: SavedMessage, isEdit: boolean) {
|
||||
const user = pluginData.client.users.get(message.user_id);
|
||||
const member = pluginData.guild.members.get(message.user_id);
|
||||
|
||||
const context: AutomodContext = {
|
||||
timestamp: moment.utc(message.posted_at).valueOf(),
|
||||
message,
|
||||
user,
|
||||
member,
|
||||
};
|
||||
|
||||
pluginData.state.queue.add(async () => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue