mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-23 17:45:03 +00:00
remove unused stuff
This commit is contained in:
parent
0130ec6225
commit
9f60a04e36
3 changed files with 9 additions and 20 deletions
|
@ -12,7 +12,6 @@ export const RunAutomodOnThreadCreate = typedGuildEventListener<AutomodPluginTyp
|
|||
|
||||
const context: AutomodContext = {
|
||||
timestamp: Date.now(),
|
||||
thread,
|
||||
threadChange: {
|
||||
created: thread,
|
||||
},
|
||||
|
@ -42,7 +41,6 @@ export const RunAutomodOnThreadDelete = typedGuildEventListener<AutomodPluginTyp
|
|||
|
||||
const context: AutomodContext = {
|
||||
timestamp: Date.now(),
|
||||
thread,
|
||||
threadChange: {
|
||||
deleted: thread,
|
||||
},
|
||||
|
@ -59,15 +57,18 @@ export const RunAutomodOnThreadDelete = typedGuildEventListener<AutomodPluginTyp
|
|||
export const RunAutomodOnThreadUpdate = typedGuildEventListener<AutomodPluginType>()({
|
||||
event: "threadUpdate",
|
||||
async listener({ pluginData, args: { oldThread, newThread: thread } }) {
|
||||
const user = thread.ownerId ? await pluginData.client.users.fetch(thread.ownerId).catch(() => void 0) : void 0;
|
||||
const user = thread.ownerId
|
||||
? await pluginData.client.users.fetch(thread.ownerId).catch(() => undefined)
|
||||
: undefined;
|
||||
|
||||
const changes: AutomodContext["threadChange"] = {};
|
||||
if (oldThread.archived !== thread.archived) {
|
||||
changes.archived = thread.archived ? thread : void 0;
|
||||
changes.unarchived = !thread.archived ? thread : void 0;
|
||||
changes.archived = thread.archived ? thread : undefined;
|
||||
changes.unarchived = !thread.archived ? thread : undefined;
|
||||
}
|
||||
if (oldThread.locked !== thread.locked) {
|
||||
changes.locked = thread.locked ? thread : void 0;
|
||||
changes.unlocked = !thread.locked ? thread : void 0;
|
||||
changes.locked = thread.locked ? thread : undefined;
|
||||
changes.unlocked = !thread.locked ? thread : undefined;
|
||||
}
|
||||
|
||||
if (Object.keys(changes).length === 0) return;
|
||||
|
@ -75,8 +76,8 @@ export const RunAutomodOnThreadUpdate = typedGuildEventListener<AutomodPluginTyp
|
|||
const context: AutomodContext = {
|
||||
timestamp: Date.now(),
|
||||
threadChange: changes,
|
||||
thread,
|
||||
user,
|
||||
channel: thread,
|
||||
};
|
||||
|
||||
pluginData.state.queue.add(() => {
|
||||
|
|
|
@ -14,7 +14,6 @@ interface ThreadArchiveResult {
|
|||
|
||||
export const ThreadArchiveTrigger = automodTrigger<ThreadArchiveResult>()({
|
||||
configType: t.type({
|
||||
parent: tNullable(t.union([t.string, t.array(t.string)])),
|
||||
locked: tNullable(t.boolean),
|
||||
}),
|
||||
|
||||
|
@ -31,11 +30,6 @@ export const ThreadArchiveTrigger = automodTrigger<ThreadArchiveResult>()({
|
|||
return;
|
||||
}
|
||||
|
||||
if (triggerConfig.parent) {
|
||||
const parentIds = Array.isArray(triggerConfig.parent) ? triggerConfig.parent : [triggerConfig.parent];
|
||||
if (thread.parentId && !parentIds.includes(thread.parentId)) return;
|
||||
}
|
||||
|
||||
return {
|
||||
extra: {
|
||||
matchedThreadId: thread.id,
|
||||
|
|
|
@ -14,7 +14,6 @@ interface ThreadUnarchiveResult {
|
|||
|
||||
export const ThreadUnarchiveTrigger = automodTrigger<ThreadUnarchiveResult>()({
|
||||
configType: t.type({
|
||||
parent: tNullable(t.union([t.string, t.array(t.string)])),
|
||||
locked: tNullable(t.boolean),
|
||||
}),
|
||||
|
||||
|
@ -31,11 +30,6 @@ export const ThreadUnarchiveTrigger = automodTrigger<ThreadUnarchiveResult>()({
|
|||
return;
|
||||
}
|
||||
|
||||
if (triggerConfig.parent) {
|
||||
const parentIds = Array.isArray(triggerConfig.parent) ? triggerConfig.parent : [triggerConfig.parent];
|
||||
if (thread.parentId && !parentIds.includes(thread.parentId)) return;
|
||||
}
|
||||
|
||||
return {
|
||||
extra: {
|
||||
matchedThreadId: thread.id,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue