refactor(discord): drop unused internal wrapper methods · openclaw/openclaw@7b94ae9
vincentkoc
·
2026-06-20
·
via Recent Commits to openclaw:main
File tree
extensions/discord/src/internal
| Original file line number | Diff line number | Diff line change |
|---|
|
1 | 1 | // Discord plugin module implements client behavior. |
2 | | -import type { APIApplicationCommand, APIInteraction } from "discord-api-types/v10"; |
| 2 | +import type { APIInteraction } from "discord-api-types/v10"; |
3 | 3 | import { resolveTimerTimeoutMs } from "openclaw/plugin-sdk/number-runtime"; |
4 | 4 | import { DiscordCommandDeployer, type DeployCommandOptions } from "./command-deploy.js"; |
5 | 5 | import type { BaseCommand } from "./commands.js"; |
@@ -272,18 +272,10 @@ export class Client {
|
272 | 272 | return await this.entityCache.fetchMember(guildId, userId); |
273 | 273 | } |
274 | 274 | |
275 | | -async getDiscordCommands(): Promise<APIApplicationCommand[]> { |
276 | | -return await this.commandDeployer.getCommands(); |
277 | | -} |
278 | | - |
279 | 275 | async deployCommands(options: DeployCommandOptions = {}) { |
280 | 276 | return await this.commandDeployer.deploy(options); |
281 | 277 | } |
282 | 278 | |
283 | | -async reconcileCommands() { |
284 | | -return await this.deployCommands({ mode: "reconcile" }); |
285 | | -} |
286 | | - |
287 | 279 | async handleInteraction(rawData: APIInteraction, _ctx?: Context): Promise<void> { |
288 | 280 | await dispatchInteraction(this, rawData); |
289 | 281 | } |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -144,9 +144,6 @@ export abstract class Command extends BaseCommand {
|
144 | 144 | `The ${(interaction as { rawData?: { data?: { name?: string } } }).rawData?.data?.name ?? this.name} command does not support autocomplete`, |
145 | 145 | ); |
146 | 146 | } |
147 | | -async preCheck(interaction: unknown): Promise<unknown> { |
148 | | -return Boolean(interaction) || true; |
149 | | -} |
150 | 147 | serializeOptions() { |
151 | 148 | return this.options?.map((option) => { |
152 | 149 | if (typeof option.autocomplete === "function") { |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -138,12 +138,6 @@ export class Row<T extends BaseMessageInteractiveComponent> extends BaseComponen
|
138 | 138 | addComponent(component: T): void { |
139 | 139 | this.components.push(component); |
140 | 140 | } |
141 | | -removeComponent(component: T): void { |
142 | | -this.components = this.components.filter((entry) => entry !== component); |
143 | | -} |
144 | | -removeAllComponents(): void { |
145 | | -this.components = []; |
146 | | -} |
147 | 141 | serialize(): APIActionRowComponent<APIComponentInMessageActionRow> { |
148 | 142 | return { |
149 | 143 | type: this.type, |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -462,18 +462,6 @@ export class GatewayPlugin extends Plugin {
|
462 | 462 | return this.outboundLimiter.getStatus(); |
463 | 463 | } |
464 | 464 | |
465 | | -getIntentsInfo() { |
466 | | -const intents = this.options.intents ?? 0; |
467 | | -return { |
468 | | - intents, |
469 | | -hasGuilds: this.hasIntent(GatewayIntentBits.Guilds), |
470 | | -hasGuildMembers: this.hasIntent(GatewayIntentBits.GuildMembers), |
471 | | -hasGuildPresences: this.hasIntent(GatewayIntentBits.GuildPresences), |
472 | | -hasGuildMessages: this.hasIntent(GatewayIntentBits.GuildMessages), |
473 | | -hasMessageContent: this.hasIntent(GatewayIntentBits.MessageContent), |
474 | | -}; |
475 | | -} |
476 | | - |
477 | 465 | hasIntent(intent: number): boolean { |
478 | 466 | return Boolean((this.options.intents ?? 0) & intent); |
479 | 467 | } |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -16,7 +16,6 @@ import {
|
16 | 16 | import { |
17 | 17 | createInteractionCallback, |
18 | 18 | createWebhookMessage, |
19 | | -deleteWebhookMessage, |
20 | 19 | editWebhookMessage, |
21 | 20 | getWebhookMessage, |
22 | 21 | } from "./api.js"; |
@@ -209,15 +208,6 @@ export class BaseInteraction {
|
209 | 208 | return result; |
210 | 209 | } |
211 | 210 | |
212 | | -async deleteReply(): Promise<unknown> { |
213 | | -return await deleteWebhookMessage( |
214 | | -this.client.rest, |
215 | | -this.client.options.clientId, |
216 | | -this.token, |
217 | | -"@original", |
218 | | -); |
219 | | -} |
220 | | - |
221 | 211 | async fetchReply(): Promise<unknown> { |
222 | 212 | return await getWebhookMessage( |
223 | 213 | this.client.rest, |
@@ -293,18 +283,6 @@ export class BaseComponentInteraction extends BaseInteraction {
|
293 | 283 | async showModal(modal: Modal): Promise<unknown> { |
294 | 284 | return await this.callback(InteractionResponseType.Modal, modal.serialize()); |
295 | 285 | } |
296 | | - |
297 | | -async editAndWaitForComponent( |
298 | | -payload: MessagePayload, |
299 | | -message: Message | null = this.message, |
300 | | -timeoutMs = 300_000, |
301 | | -) { |
302 | | -if (!message) { |
303 | | -return null; |
304 | | -} |
305 | | -const editedMessage = await message.edit(payload); |
306 | | -return await this.client.componentHandler.waitForMessageComponent(editedMessage, timeoutMs); |
307 | | -} |
308 | 286 | } |
309 | 287 | |
310 | 288 | export class ButtonInteraction extends BaseComponentInteraction {} |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。