Skip to content

Commit

Permalink
code: rename
Browse files Browse the repository at this point in the history
  • Loading branch information
binsarjr committed Jul 27, 2024
1 parent 8e1c47f commit bb3b6ee
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 10 deletions.
4 changes: 2 additions & 2 deletions libs/whatsapp-action/src/group/add-member.action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ import type { WAMessage, WASocket } from '@whiskeysockets/baileys';
import { jidEncode, jidNormalizedUser } from '@whiskeysockets/baileys';
import { findPhoneNumbersInText } from 'libphonenumber-js';
import { WhatsappGroupAction } from '@app/whatsapp/interfaces/whatsapp.group.interface';
import { Trait } from '../../../../src/decorators/trait.decorator';
import { FromMe } from '@app/whatsapp/traits/FromMe.trait';
import { TraitEligible } from '../../../../src/decorators/trait.decorator';

@Trait(FromMe)
@TraitEligible(FromMe)
@WhatsappMessage({
flags: [withSignRegex('add .*'), withSign('add')],
})
Expand Down
4 changes: 2 additions & 2 deletions libs/whatsapp-action/src/group/kick-member.action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ import { jidEncode, jidNormalizedUser } from '@whiskeysockets/baileys';
import { findPhoneNumbersInText } from 'libphonenumber-js';
import { WhatsappGroupAction } from '@app/whatsapp/interfaces/whatsapp.group.interface';
import { FromMe } from '@app/whatsapp/traits/FromMe.trait';
import { Trait } from '../../../../src/decorators/trait.decorator';
import { TraitEligible } from '../../../../src/decorators/trait.decorator';

@Trait(FromMe)
@TraitEligible(FromMe)
@WhatsappMessage({
flags: [withSignRegex('kick .*'), withSignRegex('rm .*')],
})
Expand Down
4 changes: 2 additions & 2 deletions libs/whatsapp-action/src/group/turn-off.action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import {
} from '@whiskeysockets/baileys';
import { WhatsappGroupAction } from '@app/whatsapp/interfaces/whatsapp.group.interface';
import { FromMe } from '@app/whatsapp/traits/FromMe.trait';
import { Trait } from '../../../../src/decorators/trait.decorator';
import { TraitEligible } from '../../../../src/decorators/trait.decorator';

@Trait(FromMe)
@TraitEligible(FromMe)
@WhatsappMessage({
flags: [withSign('off')],
})
Expand Down
4 changes: 2 additions & 2 deletions libs/whatsapp-action/src/group/turn-on.action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import {
} from '@whiskeysockets/baileys';
import { WhatsappGroupAction } from '@app/whatsapp/interfaces/whatsapp.group.interface';
import { FromMe } from '@app/whatsapp/traits/FromMe.trait';
import { Trait } from '../../../../src/decorators/trait.decorator';
import { TraitEligible } from '../../../../src/decorators/trait.decorator';

@Trait(FromMe)
@TraitEligible(FromMe)
@WhatsappMessage({
flags: [withSign('on')],
})
Expand Down
4 changes: 2 additions & 2 deletions libs/whatsapp/src/interfaces/whatsapp.group.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import {
} from '@whiskeysockets/baileys';
import { getJid } from '@app/whatsapp/supports/message.support';
import { LIMITIED_QUEUE } from '@services/queue';
import { Trait } from '../../../../src/decorators/trait.decorator';
import { IsGroup } from '@app/whatsapp/traits/IsGroup.trait';
import { TraitEligible } from '../../../../src/decorators/trait.decorator';

@Trait(IsGroup)
@TraitEligible(IsGroup)
export abstract class WhatsappGroupAction extends WhatsappMessageAction {
protected async isAdmin(socket: WASocket, message: WAMessage) {
const metadata = await LIMITIED_QUEUE.add(() =>
Expand Down
2 changes: 2 additions & 0 deletions src/decorators/trait.decorator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,5 @@ export function Trait(traitClass: new (...args: any[]) => any) {
});
};
}

export const TraitEligible = Trait;

0 comments on commit bb3b6ee

Please sign in to comment.