Skip to content

Commit

Permalink
pnpm lint fix
Browse files Browse the repository at this point in the history
  • Loading branch information
binsarjr committed Jan 23, 2025
1 parent 6f4495a commit 8f73df0
Show file tree
Hide file tree
Showing 15 changed files with 84 additions and 86 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import { FunctionDeclaration } from '@google/generative-ai';
import {
applyClassMetadata,
applyMethodMetadata,
} from 'src/supports/decorator.support';
import { applyMethodMetadata } from 'src/supports/decorator.support';
import { GeminiFunctionMetadataKey } from '../constants';

export const GeminiFunction = (declaration: FunctionDeclaration) =>
Expand Down
1 change: 0 additions & 1 deletion libs/gemini-tools/src/tools/roasting-github.service.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import {
FunctionDeclaration,
FunctionDeclarationSchemaType,
Tool,
} from '@google/generative-ai';
import { GeminiFunction } from '../decorators/gemini-function.decorator';

Expand Down
6 changes: 3 additions & 3 deletions libs/prisma/src/prisma.service.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Injectable, type OnModuleInit } from '@nestjs/common'
import { Prisma, PrismaClient } from '@prisma/client'
import { Logger } from '@src/services/logger'
import { Injectable, type OnModuleInit } from '@nestjs/common';
import { Prisma, PrismaClient } from '@prisma/client';
import { Logger } from '@src/services/logger';

type PrismaOption = PrismaClient<Prisma.PrismaClientOptions, never>;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export class InstagramDownloaderAction extends WhatsappMessageAction {
urls.map(async (url) => {
const { success, data } = await this.download(url.toString());
if (success) {
for (const { thumb, url, is_video } of data) {
for (const { url, is_video } of data) {
if (is_video) {
await socket.sendMessage(
jid,
Expand Down
18 changes: 9 additions & 9 deletions libs/whatsapp-action/src/group/add-member.action.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import { WhatsappMessage } from '@app/whatsapp/decorators/whatsapp-message.decorator'
import { WhatsappGroupAction } from '@app/whatsapp/interfaces/whatsapp.group.interface'
import { withSign, withSignRegex } from '@app/whatsapp/supports/flag.support'
import { WhatsappMessage } from '@app/whatsapp/decorators/whatsapp-message.decorator';
import { WhatsappGroupAction } from '@app/whatsapp/interfaces/whatsapp.group.interface';
import { withSign, withSignRegex } from '@app/whatsapp/supports/flag.support';
import {
getContextInfo,
getJid,
getMessageCaption,
getMessageQutoedCaption,
} from '@app/whatsapp/supports/message.support'
import { FromMe } from '@app/whatsapp/traits/FromMe.trait'
import { TraitEligible } from '@src/decorators/trait.decorator'
import type { WAMessage, WASocket } from '@whiskeysockets/baileys'
import { jidEncode, jidNormalizedUser } from '@whiskeysockets/baileys'
import { findPhoneNumbersInText } from 'libphonenumber-js'
} from '@app/whatsapp/supports/message.support';
import { FromMe } from '@app/whatsapp/traits/FromMe.trait';
import { TraitEligible } from '@src/decorators/trait.decorator';
import type { WAMessage, WASocket } from '@whiskeysockets/baileys';
import { jidEncode, jidNormalizedUser } from '@whiskeysockets/baileys';
import { findPhoneNumbersInText } from 'libphonenumber-js';

@TraitEligible(FromMe)
@WhatsappMessage({
Expand Down
18 changes: 9 additions & 9 deletions libs/whatsapp-action/src/group/kick-member.action.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import { WhatsappMessage } from '@app/whatsapp/decorators/whatsapp-message.decorator'
import { WhatsappGroupAction } from '@app/whatsapp/interfaces/whatsapp.group.interface'
import { withSignRegex } from '@app/whatsapp/supports/flag.support'
import { WhatsappMessage } from '@app/whatsapp/decorators/whatsapp-message.decorator';
import { WhatsappGroupAction } from '@app/whatsapp/interfaces/whatsapp.group.interface';
import { withSignRegex } from '@app/whatsapp/supports/flag.support';
import {
getContextInfo,
getJid,
getMessageCaption,
getMessageQutoedCaption,
} from '@app/whatsapp/supports/message.support'
import { FromMe } from '@app/whatsapp/traits/FromMe.trait'
import { TraitEligible } from '@src/decorators/trait.decorator'
import type { WAMessage, WASocket } from '@whiskeysockets/baileys'
import { jidEncode, jidNormalizedUser } from '@whiskeysockets/baileys'
import { findPhoneNumbersInText } from 'libphonenumber-js'
} from '@app/whatsapp/supports/message.support';
import { FromMe } from '@app/whatsapp/traits/FromMe.trait';
import { TraitEligible } from '@src/decorators/trait.decorator';
import type { WAMessage, WASocket } from '@whiskeysockets/baileys';
import { jidEncode, jidNormalizedUser } from '@whiskeysockets/baileys';
import { findPhoneNumbersInText } from 'libphonenumber-js';

@TraitEligible(FromMe)
@WhatsappMessage({
Expand Down
14 changes: 7 additions & 7 deletions libs/whatsapp-action/src/group/turn-off.action.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { PrismaService } from '@app/prisma'
import { WhatsappMessage } from '@app/whatsapp/decorators/whatsapp-message.decorator'
import { WhatsappGroupAction } from '@app/whatsapp/interfaces/whatsapp.group.interface'
import { withSign } from '@app/whatsapp/supports/flag.support'
import { FromMe } from '@app/whatsapp/traits/FromMe.trait'
import { TraitEligible } from '@src/decorators/trait.decorator'
import { PrismaService } from '@app/prisma';
import { WhatsappMessage } from '@app/whatsapp/decorators/whatsapp-message.decorator';
import { WhatsappGroupAction } from '@app/whatsapp/interfaces/whatsapp.group.interface';
import { withSign } from '@app/whatsapp/supports/flag.support';
import { FromMe } from '@app/whatsapp/traits/FromMe.trait';
import { TraitEligible } from '@src/decorators/trait.decorator';
import {
jidNormalizedUser,
type WAMessage,
type WASocket,
} from '@whiskeysockets/baileys'
} from '@whiskeysockets/baileys';

@TraitEligible(FromMe)
@WhatsappMessage({
Expand Down
14 changes: 7 additions & 7 deletions libs/whatsapp-action/src/group/turn-on.action.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { PrismaService } from '@app/prisma'
import { WhatsappMessage } from '@app/whatsapp/decorators/whatsapp-message.decorator'
import { WhatsappGroupAction } from '@app/whatsapp/interfaces/whatsapp.group.interface'
import { withSign } from '@app/whatsapp/supports/flag.support'
import { FromMe } from '@app/whatsapp/traits/FromMe.trait'
import { TraitEligible } from '@src/decorators/trait.decorator'
import { PrismaService } from '@app/prisma';
import { WhatsappMessage } from '@app/whatsapp/decorators/whatsapp-message.decorator';
import { WhatsappGroupAction } from '@app/whatsapp/interfaces/whatsapp.group.interface';
import { withSign } from '@app/whatsapp/supports/flag.support';
import { FromMe } from '@app/whatsapp/traits/FromMe.trait';
import { TraitEligible } from '@src/decorators/trait.decorator';
import {
jidNormalizedUser,
type WAMessage,
type WASocket,
} from '@whiskeysockets/baileys'
} from '@whiskeysockets/baileys';

@TraitEligible(FromMe)
@WhatsappMessage({
Expand Down
4 changes: 1 addition & 3 deletions libs/whatsapp-action/src/random/convert-to-hd.action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ export class ConvertToHDAction extends WhatsappMessageAction {
let directPath: string | null | undefined;
let url: string | null | undefined;

let photoBuffer: Buffer;

if (
message?.extendedTextMessage?.contextInfo?.quotedMessage?.imageMessage
) {
Expand All @@ -46,7 +44,7 @@ export class ConvertToHDAction extends WhatsappMessageAction {
return;
}

photoBuffer = await downloadContentBufferFromMessage(
const photoBuffer: Buffer = await downloadContentBufferFromMessage(
{ directPath, mediaKey, url },
'image',
);
Expand Down
2 changes: 1 addition & 1 deletion libs/whatsapp-action/src/random/ping.action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ ${textDisk.join('\n\n')}
getPing(messageTimestamp: number) {
const rtf = new Intl.RelativeTimeFormat('id-ID', { numeric: 'auto' });

let timestamp = messageTimestamp.toString().padEnd(13, '0');
const timestamp = messageTimestamp.toString().padEnd(13, '0');
const ping = Date.now() - (+timestamp || Date.now());
return `Pong! ${rtf.format(+ping / 1_000, 'seconds')}${ReadMoreUnicode}`;
}
Expand Down
2 changes: 1 addition & 1 deletion libs/whatsapp/src/core/whatsapp-auth.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export class WhatsappAuthService {
creds: creds,
keys: {
get: async (type: any, ids: any) => {
// @ts-ignore
// @ts-expect-error: type is not in type
const data: { [_: string]: SignalDataTypeMap[typeof type] } = {};
await Promise.all(
ids.map(async (id: string) => {
Expand Down
4 changes: 2 additions & 2 deletions libs/whatsapp/src/core/whatsapp-connection.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export class WhatsappConnectionService {
async connectToWhatsapp(deviceId: string) {
const logger = Logger({ name: 'WhatsappConnectionService-' + deviceId });
const { saveCreds, state } = await this.authService.execute(deviceId);
const { version, isLatest } = await fetchLatestBaileysVersion();
const { version } = await fetchLatestBaileysVersion();

const socket = makeWASocket({
version,
Expand All @@ -44,7 +44,7 @@ export class WhatsappConnectionService {
keys: state.keys,
},
browser: ['PersonalAsistant', 'Chrome', '0.0.0'],
// @ts-ignore
// @ts-expect-error: no error
logger: logger,
generateHighQualityLinkPreview: true,
printQRInTerminal: true,
Expand Down
12 changes: 6 additions & 6 deletions libs/whatsapp/src/interfaces/whatsapp.group.interface.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { WhatsappMessageAction } from '@app/whatsapp/interfaces/whatsapp.interface'
import { getJid } from '@app/whatsapp/supports/message.support'
import { IsGroup } from '@app/whatsapp/traits/IsGroup.trait'
import { LIMITIED_QUEUE } from '@services/queue'
import { TraitEligible } from '@src/decorators/trait.decorator'
import { WhatsappMessageAction } from '@app/whatsapp/interfaces/whatsapp.interface';
import { getJid } from '@app/whatsapp/supports/message.support';
import { IsGroup } from '@app/whatsapp/traits/IsGroup.trait';
import { LIMITIED_QUEUE } from '@services/queue';
import { TraitEligible } from '@src/decorators/trait.decorator';
import {
jidNormalizedUser,
WAMessage,
WASocket,
} from '@whiskeysockets/baileys'
} from '@whiskeysockets/baileys';

@TraitEligible(IsGroup)
export abstract class WhatsappGroupAction extends WhatsappMessageAction {
Expand Down
60 changes: 32 additions & 28 deletions src/supports/unicode.support.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* eslint-disable @typescript-eslint/no-unused-vars */
/* eslint-disable @typescript-eslint/ban-ts-comment */
// https://330k.github.io/misc_tools/unicode_steganography.html

/**
Expand Down Expand Up @@ -99,7 +101,7 @@ export class UnicodeSteganographer {
* @returns object with original text and hidden data
*/
decodeText(text: string): { originalText: string; hiddenText: string } {
let splitted = this.splitZeroWidthCharacters(text);
const splitted = this.splitZeroWidthCharacters(text);
return {
originalText: splitted.originalText,
hiddenText: this.decodeFromZeroWidthCharactersText(
Expand All @@ -115,20 +117,20 @@ export class UnicodeSteganographer {
* @returns object with original text and hidden data
*/
decodeBinary(text: string): { originalText: string; hiddenData: Uint8Array } {
let splitted = this.splitZeroWidthCharacters(text);
const splitted = this.splitZeroWidthCharacters(text);
return {
originalText: splitted.originalText,
hiddenData: this.decodeFromZeroWidthCharactersBinary(splitted.hiddenText),
};
}

private encodeToZeroWidthCharactersText(str: string): string {
var result = new Array(str.length);
var base = '';
var i;
var c;
var d;
var r;
const result = new Array(str.length);
let base = '';
let i;
let c;
let d;
let r;

//var base = '0'.repeat(codelength); // IE not support this method
for (i = 0; i < this.codelengthText; i++) {
Expand All @@ -152,12 +154,12 @@ export class UnicodeSteganographer {
}

private encodeToZeroWidthCharactersBinary(u8ary: Uint8Array): string {
var result = new Array(u8ary.length);
var base = '';
var i;
var c;
var d;
var r;
const result = new Array(u8ary.length);
let base = '';
let i;
let c;
let d;
let r;

for (i = 0; i < this.codelengthBinary; i++) {
base += '0';
Expand All @@ -182,20 +184,20 @@ export class UnicodeSteganographer {
str2: string,
codelength: number,
): string {
var result = [];
var c0 = str1.split(
let result = [];
const c0 = str1.split(
/([\u0000-\u002F\u003A-\u0040\u005b-\u0060\u007b-\u007f])|([\u0030-\u0039]+)|([\u0041-\u005a\u0061-\u007a]+)|([\u0080-\u00FF]+)|([\u0100-\u017F]+)|([\u0180-\u024F]+)|([\u0250-\u02AF]+)|([\u02B0-\u02FF]+)|([\u0300-\u036F]+)|([\u0370-\u03FF]+)|([\u0400-\u04FF]+)|([\u0500-\u052F]+)|([\u0530-\u058F]+)|([\u0590-\u05FF]+)|([\u0600-\u06FF]+)|([\u0700-\u074F]+)|([\u0750-\u077F]+)|([\u0780-\u07BF]+)|([\u07C0-\u07FF]+)|([\u0800-\u083F]+)|([\u0840-\u085F]+)|([\u08A0-\u08FF]+)|([\u0900-\u097F]+)|([\u0980-\u09FF]+)|([\u0A00-\u0A7F]+)|([\u0A80-\u0AFF]+)|([\u0B00-\u0B7F]+)|([\u0B80-\u0BFF]+)|([\u0C00-\u0C7F]+)|([\u0C80-\u0CFF]+)|([\u0D00-\u0D7F]+)|([\u0D80-\u0DFF]+)|([\u0E00-\u0E7F]+)|([\u0E80-\u0EFF]+)|([\u0F00-\u0FFF]+)|([\u1000-\u109F]+)|([\u10A0-\u10FF]+)|([\u1100-\u11FF]+)|([\u1200-\u137F]+)|([\u1380-\u139F]+)|([\u13A0-\u13FF]+)|([\u1400-\u167F]+)|([\u1680-\u169F]+)|([\u16A0-\u16FF]+)|([\u1700-\u171F]+)|([\u1720-\u173F]+)|([\u1740-\u175F]+)|([\u1760-\u177F]+)|([\u1780-\u17FF]+)|([\u1800-\u18AF]+)|([\u18B0-\u18FF]+)|([\u1900-\u194F]+)|([\u1950-\u197F]+)|([\u1980-\u19DF]+)|([\u19E0-\u19FF]+)|([\u1A00-\u1A1F]+)|([\u1A20-\u1AAF]+)|([\u1AB0-\u1AFF]+)|([\u1B00-\u1B7F]+)|([\u1B80-\u1BBF]+)|([\u1BC0-\u1BFF]+)|([\u1C00-\u1C4F]+)|([\u1C50-\u1C7F]+)|([\u1CC0-\u1CCF]+)|([\u1CD0-\u1CFF]+)|([\u1D00-\u1D7F]+)|([\u1D80-\u1DBF]+)|([\u1DC0-\u1DFF]+)|([\u1E00-\u1EFF]+)|([\u1F00-\u1FFF]+)|([\u2000-\u206F]+)|([\u2070-\u209F]+)|([\u20A0-\u20CF]+)|([\u20D0-\u20FF]+)|([\u2100-\u214F]+)|([\u2150-\u218F]+)|([\u2190-\u21FF]+)|([\u2200-\u22FF]+)|([\u2300-\u23FF]+)|([\u2400-\u243F]+)|([\u2440-\u245F]+)|([\u2460-\u24FF]+)|([\u2500-\u257F]+)|([\u2580-\u259F]+)|([\u25A0-\u25FF]+)|([\u2600-\u26FF]+)|([\u2700-\u27BF]+)|([\u27C0-\u27EF]+)|([\u27F0-\u27FF]+)|([\u2800-\u28FF]+)|([\u2900-\u297F]+)|([\u2980-\u29FF]+)|([\u2A00-\u2AFF]+)|([\u2B00-\u2BFF]+)|([\u2C00-\u2C5F]+)|([\u2C60-\u2C7F]+)|([\u2C80-\u2CFF]+)|([\u2D00-\u2D2F]+)|([\u2D30-\u2D7F]+)|([\u2D80-\u2DDF]+)|([\u2DE0-\u2DFF]+)|([\u2E00-\u2E7F]+)|([\u2E80-\u2EFF]+)|([\u2F00-\u2FDF]+)|([\u2FF0-\u2FFF]+)|([\u3000-\u303F]+)|([\u3040-\u309F]+)|([\u30A0-\u30FF]+)|([\u3100-\u312F]+)|([\u3130-\u318F]+)|([\u3190-\u319F]+)|([\u31A0-\u31BF]+)|([\u31C0-\u31EF]+)|([\u31F0-\u31FF]+)|([\u3200-\u32FF]+)|([\u3300-\u33FF]+)|([\u3400-\u4DBF]+)|([\u4DC0-\u4DFF]+)|([\u4E00-\u9FFF]+)|([\uA000-\uA48F]+)|([\uA490-\uA4CF]+)|([\uA4D0-\uA4FF]+)|([\uA500-\uA63F]+)|([\uA640-\uA69F]+)|([\uA6A0-\uA6FF]+)|([\uA700-\uA71F]+)|([\uA720-\uA7FF]+)|([\uA800-\uA82F]+)|([\uA830-\uA83F]+)|([\uA840-\uA87F]+)|([\uA880-\uA8DF]+)|([\uA8E0-\uA8FF]+)|([\uA900-\uA92F]+)|([\uA930-\uA95F]+)|([\uA960-\uA97F]+)|([\uA980-\uA9DF]+)|([\uA9E0-\uA9FF]+)|([\uAA00-\uAA5F]+)|([\uAA60-\uAA7F]+)|([\uAA80-\uAADF]+)|([\uAAE0-\uAAFF]+)|([\uAB00-\uAB2F]+)|([\uAB30-\uAB6F]+)|([\uAB70-\uABBF]+)|([\uABC0-\uABFF]+)|([\uAC00-\uD7AF]+)|([\uD7B0-\uD7FF]+)|([\uD800-\uDFFF]+)|([\uE000-\uF8FF]+)|([\uF900-\uFAFF]+)|([\uFB00-\uFB4F]+)|([\uFB50-\uFDFF]+)|([\uFE00-\uFE0F]+)|([\uFE10-\uFE1F]+)|([\uFE20-\uFE2F]+)|([\uFE30-\uFE4F]+)|([\uFE50-\uFE6F]+)|([\uFE70-\uFEFF]+)|([\uFF00-\uFFEF]+)|([\uFFF0-\uFFFF]+)/g,
);
var c1 = [];
var i;
var j;
let c1 = [];
let i;
let j;
for (i = 0; i < c0.length; i++) {
if (typeof c0[i] !== 'undefined' && c0[i] !== '') {
c1.push(c0[i]);
}
}
var c2 = str2.split(new RegExp('(.{' + codelength + '})', 'g'));
var ratio = c1.length / (c1.length + c2.length);
let c2 = str2.split(new RegExp('(.{' + codelength + '})', 'g'));
const ratio = c1.length / (c1.length + c2.length);

/* slow
while((c1.length > 0) && (c2.length > 0)){
Expand Down Expand Up @@ -244,9 +246,9 @@ export class UnicodeSteganographer {
str: string,
codelength: number,
): string {
var r = str;
var i;
var result = [];
let r = str;
let i;
const result = [];
for (i = 0; i < this.radix; i++) {
r = r.replace(new RegExp(this.chars[i], 'g'), i);
}
Expand All @@ -262,10 +264,12 @@ export class UnicodeSteganographer {
}

private decodeFromZeroWidthCharactersBinary(str: string): Uint8Array {
var r = str;
var i;
var j;
var result = new Uint8Array(Math.ceil(str.length / this.codelengthBinary));
let r = str;
let i;
let j;
const result = new Uint8Array(
Math.ceil(str.length / this.codelengthBinary),
);

for (i = 0; i < this.radix; i++) {
r = r.replace(new RegExp(this.chars[i], 'g'), i);
Expand Down
8 changes: 4 additions & 4 deletions test/app.e2e-spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { INestApplication } from '@nestjs/common'
import { Test, TestingModule } from '@nestjs/testing'
import { AppModule } from '@src/app.module'
import * as request from 'supertest'
import { INestApplication } from '@nestjs/common';
import { Test, TestingModule } from '@nestjs/testing';
import { AppModule } from '@src/app.module';
import * as request from 'supertest';

describe('AppController (e2e)', () => {
let app: INestApplication;
Expand Down

0 comments on commit 8f73df0

Please sign in to comment.