mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-24 10:05: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 = {
|
const context: AutomodContext = {
|
||||||
timestamp: Date.now(),
|
timestamp: Date.now(),
|
||||||
thread,
|
|
||||||
threadChange: {
|
threadChange: {
|
||||||
created: thread,
|
created: thread,
|
||||||
},
|
},
|
||||||
|
@ -42,7 +41,6 @@ export const RunAutomodOnThreadDelete = typedGuildEventListener<AutomodPluginTyp
|
||||||
|
|
||||||
const context: AutomodContext = {
|
const context: AutomodContext = {
|
||||||
timestamp: Date.now(),
|
timestamp: Date.now(),
|
||||||
thread,
|
|
||||||
threadChange: {
|
threadChange: {
|
||||||
deleted: thread,
|
deleted: thread,
|
||||||
},
|
},
|
||||||
|
@ -59,15 +57,18 @@ export const RunAutomodOnThreadDelete = typedGuildEventListener<AutomodPluginTyp
|
||||||
export const RunAutomodOnThreadUpdate = typedGuildEventListener<AutomodPluginType>()({
|
export const RunAutomodOnThreadUpdate = typedGuildEventListener<AutomodPluginType>()({
|
||||||
event: "threadUpdate",
|
event: "threadUpdate",
|
||||||
async listener({ pluginData, args: { oldThread, newThread: thread } }) {
|
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"] = {};
|
const changes: AutomodContext["threadChange"] = {};
|
||||||
if (oldThread.archived !== thread.archived) {
|
if (oldThread.archived !== thread.archived) {
|
||||||
changes.archived = thread.archived ? thread : void 0;
|
changes.archived = thread.archived ? thread : undefined;
|
||||||
changes.unarchived = !thread.archived ? thread : void 0;
|
changes.unarchived = !thread.archived ? thread : undefined;
|
||||||
}
|
}
|
||||||
if (oldThread.locked !== thread.locked) {
|
if (oldThread.locked !== thread.locked) {
|
||||||
changes.locked = thread.locked ? thread : void 0;
|
changes.locked = thread.locked ? thread : undefined;
|
||||||
changes.unlocked = !thread.locked ? thread : void 0;
|
changes.unlocked = !thread.locked ? thread : undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Object.keys(changes).length === 0) return;
|
if (Object.keys(changes).length === 0) return;
|
||||||
|
@ -75,8 +76,8 @@ export const RunAutomodOnThreadUpdate = typedGuildEventListener<AutomodPluginTyp
|
||||||
const context: AutomodContext = {
|
const context: AutomodContext = {
|
||||||
timestamp: Date.now(),
|
timestamp: Date.now(),
|
||||||
threadChange: changes,
|
threadChange: changes,
|
||||||
thread,
|
|
||||||
user,
|
user,
|
||||||
|
channel: thread,
|
||||||
};
|
};
|
||||||
|
|
||||||
pluginData.state.queue.add(() => {
|
pluginData.state.queue.add(() => {
|
||||||
|
|
|
@ -14,7 +14,6 @@ interface ThreadArchiveResult {
|
||||||
|
|
||||||
export const ThreadArchiveTrigger = automodTrigger<ThreadArchiveResult>()({
|
export const ThreadArchiveTrigger = automodTrigger<ThreadArchiveResult>()({
|
||||||
configType: t.type({
|
configType: t.type({
|
||||||
parent: tNullable(t.union([t.string, t.array(t.string)])),
|
|
||||||
locked: tNullable(t.boolean),
|
locked: tNullable(t.boolean),
|
||||||
}),
|
}),
|
||||||
|
|
||||||
|
@ -31,11 +30,6 @@ export const ThreadArchiveTrigger = automodTrigger<ThreadArchiveResult>()({
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (triggerConfig.parent) {
|
|
||||||
const parentIds = Array.isArray(triggerConfig.parent) ? triggerConfig.parent : [triggerConfig.parent];
|
|
||||||
if (thread.parentId && !parentIds.includes(thread.parentId)) return;
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
extra: {
|
extra: {
|
||||||
matchedThreadId: thread.id,
|
matchedThreadId: thread.id,
|
||||||
|
|
|
@ -14,7 +14,6 @@ interface ThreadUnarchiveResult {
|
||||||
|
|
||||||
export const ThreadUnarchiveTrigger = automodTrigger<ThreadUnarchiveResult>()({
|
export const ThreadUnarchiveTrigger = automodTrigger<ThreadUnarchiveResult>()({
|
||||||
configType: t.type({
|
configType: t.type({
|
||||||
parent: tNullable(t.union([t.string, t.array(t.string)])),
|
|
||||||
locked: tNullable(t.boolean),
|
locked: tNullable(t.boolean),
|
||||||
}),
|
}),
|
||||||
|
|
||||||
|
@ -31,11 +30,6 @@ export const ThreadUnarchiveTrigger = automodTrigger<ThreadUnarchiveResult>()({
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (triggerConfig.parent) {
|
|
||||||
const parentIds = Array.isArray(triggerConfig.parent) ? triggerConfig.parent : [triggerConfig.parent];
|
|
||||||
if (thread.parentId && !parentIds.includes(thread.parentId)) return;
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
extra: {
|
extra: {
|
||||||
matchedThreadId: thread.id,
|
matchedThreadId: thread.id,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue