Skip to content

Commit

Permalink
feat(FrameworkClient): add allowSelfCommand to FrameworkClientOptions
Browse files Browse the repository at this point in the history
  • Loading branch information
satoufuyuki committed Feb 8, 2024
1 parent 9562ffb commit 62a2759
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/lib/FrameworkClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,5 @@ export interface FrameworkClientOptions {
makeWASocket: () => Promise<ReturnType<typeof makeWASocket>>;
logger?: Logger;
loggerOptions?: LoggerOptions;
allowSelfCommand?: boolean;
}
2 changes: 1 addition & 1 deletion src/listeners/messagesUpsertListener.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export class MessagesUpsert extends Listener {
messageData.message?.groupInviteMessage?.caption ??
messageData.message?.liveLocationMessage?.caption;

if (messageData.key.fromMe) return;
if (messageData.key.fromMe && !this.container.client.options.allowSelfCommand) return;
const prefix = await this.container.client.options.fetchPrefix(messageData);
if (findMessage?.startsWith(prefix)) {
this.container.client.emit(
Expand Down

0 comments on commit 62a2759

Please sign in to comment.