3
0
Fork 0
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:
almeidx 2021-10-31 18:38:19 +00:00
parent 0130ec6225
commit 9f60a04e36
No known key found for this signature in database
GPG key ID: F403F80B79353CB4
3 changed files with 9 additions and 20 deletions

View file

@ -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(() => {

View file

@ -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,

View file

@ -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,