apexify.js 4.5.0 → 4.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/dist/ai/ApexAI.d.ts +13 -13
  2. package/dist/ai/ApexAI.js +5 -5
  3. package/dist/ai/ApexAI.js.map +1 -1
  4. package/dist/ai/ApexModules.d.ts.map +1 -1
  5. package/dist/ai/ApexModules.js +7 -4
  6. package/dist/ai/ApexModules.js.map +1 -1
  7. package/dist/ai/functions/draw.d.ts.map +1 -1
  8. package/dist/ai/functions/draw.js +541 -672
  9. package/dist/ai/functions/draw.js.map +1 -1
  10. package/dist/ai/functions/validOptions.d.ts +3 -3
  11. package/dist/ai/functions/validOptions.d.ts.map +1 -1
  12. package/dist/ai/functions/validOptions.js +12 -12
  13. package/dist/ai/functions/validOptions.js.map +1 -1
  14. package/dist/ai/modals-chat/rsn/rsnChat.d.ts.map +1 -1
  15. package/dist/ai/modals-chat/rsn/rsnChat.js +7 -0
  16. package/dist/ai/modals-chat/rsn/rsnChat.js.map +1 -1
  17. package/dist/index.d.ts +3 -3
  18. package/lib/ai/ApexAI.ts +4 -4
  19. package/lib/ai/ApexModules.ts +4 -2
  20. package/lib/ai/functions/draw.ts +558 -729
  21. package/lib/ai/functions/validOptions.ts +2 -2
  22. package/lib/ai/modals-chat/rsn/rsnChat.ts +11 -0
  23. package/package.json +1 -1
  24. package/dist/ai/modals-chat/hercai/chatModals.d.ts +0 -7
  25. package/dist/ai/modals-chat/hercai/chatModals.d.ts.map +0 -1
  26. package/dist/ai/modals-chat/hercai/chatModals.js +0 -23
  27. package/dist/ai/modals-chat/hercai/chatModals.js.map +0 -1
  28. package/dist/ai/modals-images/cartoon.d.ts +0 -2
  29. package/dist/ai/modals-images/cartoon.d.ts.map +0 -1
  30. package/dist/ai/modals-images/cartoon.js +0 -26
  31. package/dist/ai/modals-images/cartoon.js.map +0 -1
  32. package/dist/ai/modals-images/flux.d.ts +0 -2
  33. package/dist/ai/modals-images/flux.d.ts.map +0 -1
  34. package/dist/ai/modals-images/flux.js +0 -26
  35. package/dist/ai/modals-images/flux.js.map +0 -1
@@ -1,15 +1,24 @@
1
1
  import translate from "@iamtraction/google-translate";
2
2
  import sharp from "sharp";
3
- import { ButtonBuilder, StringSelectMenuBuilder, StringSelectMenuOptionBuilder, ButtonStyle, ActionRowBuilder, AttachmentBuilder, AttachmentData } from "discord.js";
3
+ import {
4
+ ButtonBuilder,
5
+ StringSelectMenuBuilder,
6
+ StringSelectMenuOptionBuilder,
7
+ ButtonStyle,
8
+ ActionRowBuilder,
9
+ AttachmentBuilder,
10
+ AttachmentData
11
+ } from "discord.js";
4
12
  import axios from "axios";
5
13
  import { validateModels } from './validOptions';
6
14
  import api from "api";
7
15
  import { groqAnalyzer } from "../utils";
8
16
  import { flux } from "../modals-chat/freesedgpt/flux";
9
17
  import { cartoon } from "../modals-chat/freesedgpt/cartoon";
10
-
18
+ import { rsnAPI } from "../modals-chat/rsn/rsnChat";
11
19
 
12
20
  const sdk: any = api("@prodia/v1.3.0#be019b2kls0gqss3");
21
+
13
22
  async function aiImagine(
14
23
  message: any,
15
24
  numOfImages: number,
@@ -26,18 +35,16 @@ async function aiImagine(
26
35
  ) {
27
36
  const maxRetryAttempts = 4;
28
37
  const retryInterval = 5000;
29
- let response: any;
30
38
  const imageType = await validateModels;
39
+ const attachData: AttachmentData[] = [];
40
+ const buttonsRow1: ButtonBuilder[] = [];
41
+ const imageUrls: string[] = [];
31
42
 
32
43
  async function retry(fn: any, retriesLeft = maxRetryAttempts) {
33
-
34
44
  try {
35
45
  return await fn();
36
46
  } catch (error: any) {
37
- if (retriesLeft === 0) {
38
- throw error;
39
- }
40
-
47
+ if (retriesLeft === 0) throw error;
41
48
  await new Promise((resolve) => setTimeout(resolve, retryInterval));
42
49
  return retry(fn, retriesLeft - 1);
43
50
  }
@@ -45,782 +52,605 @@ async function aiImagine(
45
52
 
46
53
  try {
47
54
  if (numOfImages > 4 || numOfImages <= 0) {
48
- throw new Error(
49
- `Number of images can't be greater than 4 or smaller than 0.`,
50
- );
55
+ throw new Error("Number of images can't be greater than 4 or smaller than 0.");
51
56
  }
52
57
 
53
58
  await message.channel?.sendTyping();
54
59
 
55
60
  const translatedText = await retry(() =>
56
- translate(textToDraw, {
57
- from: "auto",
58
- to: "en",
59
- }),
61
+ translate(textToDraw, { from: "auto", to: "en" })
60
62
  );
61
63
 
62
- const attachData: AttachmentData[] = [];
63
- const buttonsRow1: ButtonBuilder[] = [];
64
- const imageUrls: any = [];
64
+ const nsfwWords: string[] = nsfwKeyWords || [
65
+ "2g1c",
66
+ "2 girls 1 cup",
67
+ "acrotomophilia",
68
+ "alabama hot pocket",
69
+ "alaskan pipeline",
70
+ "anal",
71
+ "anilingus",
72
+ "anus",
73
+ "apeshit",
74
+ "arsehole",
75
+ "ass",
76
+ "asshole",
77
+ "assmunch",
78
+ "auto erotic",
79
+ "autoerotic",
80
+ "babeland",
81
+ "baby batter",
82
+ "baby juice",
83
+ "ball gag",
84
+ "ball gravy",
85
+ "ball kicking",
86
+ "ball licking",
87
+ "ball sack",
88
+ "ball sucking",
89
+ "bangbros",
90
+ "bangbus",
91
+ "bareback",
92
+ "barely legal",
93
+ "barenaked",
94
+ "bastard",
95
+ "bastardo",
96
+ "bastinado",
97
+ "bbw",
98
+ "bdsm",
99
+ "beaner",
100
+ "beaners",
101
+ "beaver cleaver",
102
+ "beaver lips",
103
+ "beastiality",
104
+ "bestiality",
105
+ "big black",
106
+ "big breasts",
107
+ "big knockers",
108
+ "big tits",
109
+ "bimbos",
110
+ "birdlock",
111
+ "bitch",
112
+ "bitches",
113
+ "black cock",
114
+ "blonde action",
115
+ "blonde on blonde action",
116
+ "blowjob",
117
+ "blow job",
118
+ "blow your load",
119
+ "blue waffle",
120
+ "blumpkin",
121
+ "bollocks",
122
+ "bondage",
123
+ "boner",
124
+ "boob",
125
+ "boobs",
126
+ "booty call",
127
+ "brown showers",
128
+ "brunette action",
129
+ "bukkake",
130
+ "bulldyke",
131
+ "bullet vibe",
132
+ "bullshit",
133
+ "bung hole",
134
+ "bunghole",
135
+ "busty",
136
+ "butt",
137
+ "buttcheeks",
138
+ "butthole",
139
+ "camel toe",
140
+ "camgirl",
141
+ "camslut",
142
+ "camwhore",
143
+ "carpet muncher",
144
+ "carpetmuncher",
145
+ "chocolate rosebuds",
146
+ "cialis",
147
+ "circlejerk",
148
+ "cleveland steamer",
149
+ "clit",
150
+ "clitoris",
151
+ "clover clamps",
152
+ "clusterfuck",
153
+ "cock",
154
+ "cocks",
155
+ "coprolagnia",
156
+ "coprophilia",
157
+ "cornhole",
158
+ "coon",
159
+ "coons",
160
+ "creampie",
161
+ "cum",
162
+ "cumming",
163
+ "cumshot",
164
+ "cumshots",
165
+ "cunnilingus",
166
+ "cunt",
167
+ "darkie",
168
+ "date rape",
169
+ "daterape",
170
+ "deep throat",
171
+ "deepthroat",
172
+ "dendrophilia",
173
+ "dick",
174
+ "dildo",
175
+ "dingleberry",
176
+ "dingleberries",
177
+ "dirty pillows",
178
+ "dirty sanchez",
179
+ "doggie style",
180
+ "doggiestyle",
181
+ "doggy style",
182
+ "doggystyle",
183
+ "dog style",
184
+ "dolcett",
185
+ "domination",
186
+ "dominatrix",
187
+ "dommes",
188
+ "donkey punch",
189
+ "double dong",
190
+ "double penetration",
191
+ "dp action",
192
+ "dry hump",
193
+ "dvda",
194
+ "eat my ass",
195
+ "ecchi",
196
+ "ejaculation",
197
+ "erotic",
198
+ "erotism",
199
+ "escort",
200
+ "eunuch",
201
+ "fag",
202
+ "faggot",
203
+ "fecal",
204
+ "felch",
205
+ "fellatio",
206
+ "feltch",
207
+ "female squirting",
208
+ "femdom",
209
+ "figging",
210
+ "fingerbang",
211
+ "fingering",
212
+ "fisting",
213
+ "foot fetish",
214
+ "footjob",
215
+ "frotting",
216
+ "fuck",
217
+ "fuck buttons",
218
+ "fuckin",
219
+ "fucking",
220
+ "fucktards",
221
+ "fudge packer",
222
+ "fudgepacker",
223
+ "futanari",
224
+ "gangbang",
225
+ "gang bang",
226
+ "gay sex",
227
+ "genitals",
228
+ "giant cock",
229
+ "girl on",
230
+ "girl on top",
231
+ "girls gone wild",
232
+ "goatcx",
233
+ "goatse",
234
+ "god damn",
235
+ "gokkun",
236
+ "golden shower",
237
+ "goodpoop",
238
+ "goo girl",
239
+ "goregasm",
240
+ "grope",
241
+ "group sex",
242
+ "g-spot",
243
+ "guro",
244
+ "hand job",
245
+ "handjob",
246
+ "hard core",
247
+ "hardcore",
248
+ "hentai",
249
+ "homoerotic",
250
+ "honkey",
251
+ "hooker",
252
+ "horny",
253
+ "hot carl",
254
+ "hot chick",
255
+ "how to kill",
256
+ "how to murder",
257
+ "huge fat",
258
+ "humping",
259
+ "incest",
260
+ "intercourse",
261
+ "jack off",
262
+ "jail bait",
263
+ "jailbait",
264
+ "jelly donut",
265
+ "jerk off",
266
+ "jigaboo",
267
+ "jiggaboo",
268
+ "jiggerboo",
269
+ "jizz",
270
+ "juggs",
271
+ "kike",
272
+ "kinbaku",
273
+ "kinkster",
274
+ "kinky",
275
+ "knobbing",
276
+ "leather restraint",
277
+ "leather straight jacket",
278
+ "lemon party",
279
+ "livesex",
280
+ "lolita",
281
+ "lovemaking",
282
+ "make me come",
283
+ "male squirting",
284
+ "masturbate",
285
+ "masturbating",
286
+ "masturbation",
287
+ "menage a trois",
288
+ "milf",
289
+ "missionary position",
290
+ "mong",
291
+ "motherfucker",
292
+ "mound of venus",
293
+ "mr hands",
294
+ "muff diver",
295
+ "muffdiving",
296
+ "nambla",
297
+ "nawashi",
298
+ "negro",
299
+ "neonazi",
300
+ "nigga",
301
+ "nigger",
302
+ "nig nog",
303
+ "nimphomania",
304
+ "nipple",
305
+ "nipples",
306
+ "nsfw",
307
+ 'nsfw images',
308
+ "nude",
309
+ "nudity",
310
+ "nutten",
311
+ "nympho",
312
+ "nymphomania",
313
+ "octopussy",
314
+ "omorashi",
315
+ "one cup two girls",
316
+ 'one guy one jar',
317
+ "orgasm",
318
+ "orgy",
319
+ 'paedophile',
320
+ "paki",
321
+ "panties",
322
+ "panty",
323
+ "pedobear",
324
+ "pedophile",
325
+ 'pegging',
326
+ 'penis',
327
+ "phone sex",
328
+ 'piece of shit',
329
+ "pikey",
330
+ "pissing",
331
+ "piss pig",
332
+ "pisspig",
333
+ "playboy",
334
+ "pleasure chest",
335
+ "pole smoker",
336
+ "ponyplay",
337
+ "poof",
338
+ "poon",
339
+ "poontang",
340
+ "punany",
341
+ "poop chute",
342
+ "poopchute",
343
+ "porn",
344
+ "porno",
345
+ "pornography",
346
+ "prince albert piercing",
347
+ "pthc",
348
+ "pubes",
349
+ "pussy",
350
+ "queaf",
351
+ "queef",
352
+ "quim",
353
+ "raghead",
354
+ "raging boner",
355
+ "rape",
356
+ "raping",
357
+ "rapist",
358
+ "rectum",
359
+ "reverse cowgirl",
360
+ "rimjob",
361
+ "rimming",
362
+ "rosy palm",
363
+ "rosy palm and her 5 sisters",
364
+ "rusty trombone",
365
+ "sadism",
366
+ "santorum",
367
+ "scat",
368
+ "schlong",
369
+ "scissoring",
370
+ "semen",
371
+ "sex",
372
+ "sexcam",
373
+ "sexo",
374
+ "sexy",
375
+ "sexual",
376
+ "sexually",
377
+ "sexuality",
378
+ "shaved beaver",
379
+ "shaved pussy",
380
+ "shemale",
381
+ "shibari",
382
+ "shit",
383
+ "shitblimp",
384
+ "shitty",
385
+ "shota",
386
+ "shrimping",
387
+ "skeet",
388
+ "slanteye",
389
+ "slut",
390
+ "s&m",
391
+ "smut",
392
+ "snatch",
393
+ "snowballing",
394
+ "sodomize",
395
+ "sodomy",
396
+ "spastic",
397
+ "spic",
398
+ "splooge",
399
+ "splooge moose",
400
+ "spooge",
401
+ "spread legs",
402
+ "spunk",
403
+ "strap on",
404
+ "strapon",
405
+ "strappado",
406
+ "strip club",
407
+ "style doggy",
408
+ "suck",
409
+ "sucks",
410
+ "suicide girls",
411
+ "sultry women",
412
+ "swastika",
413
+ "swinger",
414
+ "tainted love",
415
+ "taste my",
416
+ "tea bagging",
417
+ "threesome",
418
+ "throating",
419
+ "thumbzilla",
420
+ "tied up",
421
+ "tight white",
422
+ "tit",
423
+ "tits",
424
+ "titties",
425
+ "titty",
426
+ "topless",
427
+ "tosser",
428
+ "towelhead",
429
+ "tranny",
430
+ "tribadism",
431
+ "tub girl",
432
+ 'tubgirl',
433
+ "tushy",
434
+ "twat",
435
+ "twink",
436
+ "twinkie",
437
+ "two girls one cup",
438
+ "undressing",
439
+ 'upskirt',
440
+ "urethra play",
441
+ "urophilia",
442
+ "vagina",
443
+ "venus mound",
444
+ "viagra",
445
+ "vibrator",
446
+ "violet wand",
447
+ "vorarephilia",
448
+ "voyeur",
449
+ "voyeurweb",
450
+ "voyuer",
451
+ "vulva",
452
+ "wank",
453
+ "wetback",
454
+ "wet dream",
455
+ "white power",
456
+ "whore",
457
+ "worldsex",
458
+ "wrapping men",
459
+ "wrinkled starfish",
460
+ "xx",
461
+ "xxx",
462
+ "yaoi",
463
+ "yellow showers",
464
+ "yiffy",
465
+ "zoophilia",
466
+ "anal",
467
+ "arousal",
468
+ "balls",
469
+ "blowjob",
470
+ "busty",
471
+ "butt",
472
+ "cameltoe",
473
+ "climax",
474
+ "clitoris",
475
+ "cock",
476
+ "crotch",
477
+ "cum",
478
+ "cumshot",
479
+ "cunnilingus",
480
+ "dirty",
481
+ "dirtytalk",
482
+ "dildo",
483
+ "erect",
484
+ "erogenous",
485
+ "escort",
486
+ "explicit",
487
+ "facial",
488
+ "fetish",
489
+ "flirt",
490
+ "foreplay",
491
+ "genitals",
492
+ "groin",
493
+ "hardcore",
494
+ "hardon",
495
+ "horniness",
496
+ "horny",
497
+ "kamasutra",
498
+ "kinky",
499
+ "lewd",
500
+ "lingerie",
501
+ "lust",
502
+ "lustful",
503
+ "masturbate",
504
+ "mature",
505
+ "milf",
506
+ "naughty",
507
+ "naked",
508
+ "nipples",
509
+ "nude",
510
+ "obscene",
511
+ "oral",
512
+ "orgasm",
513
+ "penetration",
514
+ "penis",
515
+ "pleasure",
516
+ "porn",
517
+ "prostitute",
518
+ "provocative",
519
+ "pubic",
520
+ "pussy",
521
+ "seduce",
522
+ "seductive",
523
+ "sensual",
524
+ "sex",
525
+ "sexual",
526
+ "sperm",
527
+ "strip",
528
+ "striptease",
529
+ "swinger",
530
+ "testicles",
531
+ "thong",
532
+ "threesome",
533
+ "undies",
534
+ "undress",
535
+ "vagina",
536
+ "vibrator",
537
+ "wank",
538
+ "wet",
539
+ "hentai",
540
+ "bdsm",
541
+ "gay",
542
+ "lesbian",
543
+ "femboy",
544
+ "ass",
545
+ ];
546
+ if (deepCheck) {
547
+ if (translatedText.text && nsfwWords.some(word => translatedText.text.includes(word))) {
548
+ return message.reply("Warning ⚠️. Your prompt contains **`NSFW/Illegal/Prohibited`** words. Please refrain from doing this.");
549
+ }
550
+
551
+ if (textToDraw && nsfwWords.some(word => textToDraw.includes(word))) {
552
+ return message.reply("Warning ⚠️. Your prompt contains **`NSFW/Illegal/Prohibited`** words. Please refrain from doing this.");
553
+ }
554
+ }
555
+
556
+ for (let i = 0; i < numOfImages; i++) {
557
+ let response: any;
65
558
 
66
- for (let _0x4d7fb6 = 0x0; _0x4d7fb6 < numOfImages; _0x4d7fb6++) {
67
559
  try {
68
560
  if (imageModal === 'prodia-v2') {
69
- response = await retry(() =>
70
- hercai.betaDrawImage({
71
- prompt: translatedText.text,
72
- negative_prompt: enhancer.negative_prompt,
73
- sampler: enhancer.sampler,
74
- image_style: enhancer.imgStyle,
75
- width: enhancer.width,
76
- height: enhancer.height,
77
- steps: enhancer.steps,
78
- scale: enhancer.cfgScale,
79
- }),
80
- );
81
- if (response.url === 'This Modal is Currently Under Maintenance.') throw new Error('this model is under Maintenance for a while.')
82
-
561
+ response = await retry(() => hercai.betaDrawImage({ prompt: translatedText.text, ...enhancer }));
83
562
  } else if (imageType.validHercaiModels.includes(imageModal)) {
84
- response = await retry(() =>
85
- hercai.drawImage({
86
- model: imageModal,
87
- prompt: translatedText.text,
88
- }),
89
- );
563
+ response = await retry(() => hercai.drawImage({ model: imageModal, prompt: translatedText.text }));
90
564
  } else if (imageType.validProdiaModels.includes(imageModal)) {
91
565
  sdk.auth(imageAPIS?.prodiaAPI);
92
-
93
- const generateResponse = await sdk.generate({
94
- model: imageModal,
95
- prompt: translatedText.text,
96
- negative_prompt: enhancer.negative_prompt,
97
- style_preset: enhancer.imgStyle,
98
- cfg_scale: enhancer.cfgScale,
99
- sampler: enhancer.sampler,
100
- seed: enhancer.seed,
101
- steps: enhancer.steps,
102
- width: enhancer.width,
103
- height: enhancer.height
104
- });
105
-
106
- await message.channel?.sendTyping();
107
-
566
+ const generateResponse = await sdk.generate({ model: imageModal, prompt: translatedText.text, ...enhancer });
108
567
  const generatedJobId = generateResponse.data.job;
109
568
  response = await checkJobStatus(generatedJobId);
110
569
  } else if (imageType.validSXDL.includes(imageModal)) {
111
570
  sdk.auth(imageAPIS?.prodiaAPI);
112
-
113
- const generateResponse = await sdk.sdxlGenerate({
114
- model: imageModal,
115
- prompt: translatedText.text,
116
- negative_prompt: enhancer.negative_prompt,
117
- style_preset: enhancer.imgStyle,
118
- cfg_scale: enhancer.cfgScale,
119
- sampler: enhancer.sampler,
120
- seed: enhancer.seed,
121
- steps: enhancer.steps,
122
- width: enhancer.width,
123
- height: enhancer.height
124
- });
125
-
126
- await message.channel?.sendTyping();
127
-
571
+ const generateResponse = await sdk.sdxlGenerate({ model: imageModal, prompt: translatedText.text, ...enhancer });
128
572
  const generatedJobId = generateResponse.data.job;
129
573
  response = await checkJobStatus(generatedJobId);
130
574
  } else if (imageModal === 'flux-schnell') {
131
- const gen = await flux(translatedText.text, imageAPIS?.freesedGPTApi as string);
132
- if (gen === null) return message.reply(`Please wait i am in a cool down for a minute`);
133
- response = gen
134
-
575
+ response = await flux(translatedText.text, imageAPIS?.freesedGPTApi as any);
135
576
  } else if (imageModal === 'real-cartoon-xl-v6') {
136
- const gen = await cartoon(translatedText.text, imageAPIS?.freesedGPTApi as string);
137
- if (gen === null) return message.reply(`Please wait i am in a cool down for a minute`);
138
- response = gen
577
+ response = await cartoon(translatedText.text, imageAPIS?.freesedGPTApi as any );
578
+ } else if (imageModal === 'dalle') {
579
+ response = await rsnAPI({ API_KEY: imageAPIS?.rsnAPI, prompt: translatedText.text, apiName: 'dalle' });
139
580
  } else {
140
581
  throw new Error("Invalid modal name.");
141
582
  }
142
- } catch (error: any) {
143
- if (error.response && error.response.status === 429) {
144
- console.error("Too many requests. Please try again later.");
145
- return message.reply(`Please wait i am in a cool down for a minute`);
146
- } else if (error.response && error.response.status === 500) {
147
- console.error("Internal server error. Please try again later.");
148
- return message.reply(`Please wait i am in a cool down for a minute`);
149
- } else {
150
- await message.reply(`Please wait i am in a cool down for a minute`);
151
- throw new Error("Error processing message in file");
583
+
584
+ if (!response || response === 'This Modal is Currently Under Maintenance.') {
585
+ throw new Error('Model under maintenance.');
152
586
  }
587
+ } catch (error) {
588
+ console.error(error);
589
+ return message.reply(`Please wait, I am in cooldown for a minute.`);
153
590
  }
154
- let buffferedImage: any;
155
-
156
- if (imageModal === "v3") {
157
- const res = await retry(() =>
158
- axios.get(response.url, {
159
- responseType: "arraybuffer",
160
- }),
161
- );
162
-
163
- await message.channel?.sendTyping();
164
-
165
- buffferedImage = Buffer.from(res.data, "binary");
166
-
167
- const resizedImage = await sharp(buffferedImage)
168
- .resize({
169
- width: 2048,
170
- height: 2048,
171
- fit: 'cover',
172
- })
173
- .sharpen({
174
- sigma: 2,
175
- m1: 1.5,
176
- m2: 3,
177
- y2: 20,
178
- x1: 1,
179
- })
180
- .toBuffer();
181
-
182
- const attachment = {
183
- file: resizedImage,
184
- name: `image_${_0x4d7fb6 + 1}.png`,
185
- } as AttachmentData;
186
-
187
- attachData.push(attachment);
188
-
189
- const urlButton = new ButtonBuilder()
190
- .setStyle(ButtonStyle.Link)
191
- .setLabel(`Image ${_0x4d7fb6 + 1}`)
192
- .setURL(response.url);
193
-
194
- buttonsRow1.push(urlButton);
195
-
196
- imageUrls.push(response.url);
197
- } else {
198
- const imageUrl = response.url || response;
199
-
200
- await message.channel?.sendTyping();
201
-
202
- const nsfwWords: string[] = [
203
- "2g1c",
204
- "2 girls 1 cup",
205
- "acrotomophilia",
206
- "alabama hot pocket",
207
- "alaskan pipeline",
208
- "anal",
209
- "anilingus",
210
- "anus",
211
- "apeshit",
212
- "arsehole",
213
- "ass",
214
- "asshole",
215
- "assmunch",
216
- "auto erotic",
217
- "autoerotic",
218
- "babeland",
219
- "baby batter",
220
- "baby juice",
221
- "ball gag",
222
- "ball gravy",
223
- "ball kicking",
224
- "ball licking",
225
- "ball sack",
226
- "ball sucking",
227
- "bangbros",
228
- "bangbus",
229
- "bareback",
230
- "barely legal",
231
- "barenaked",
232
- "bastard",
233
- "bastardo",
234
- "bastinado",
235
- "bbw",
236
- "bdsm",
237
- "beaner",
238
- "beaners",
239
- "beaver cleaver",
240
- "beaver lips",
241
- "beastiality",
242
- "bestiality",
243
- "big black",
244
- "big breasts",
245
- "big knockers",
246
- "big tits",
247
- "bimbos",
248
- "birdlock",
249
- "bitch",
250
- "bitches",
251
- "black cock",
252
- "blonde action",
253
- "blonde on blonde action",
254
- "blowjob",
255
- "blow job",
256
- "blow your load",
257
- "blue waffle",
258
- "blumpkin",
259
- "bollocks",
260
- "bondage",
261
- "boner",
262
- "boob",
263
- "boobs",
264
- "booty call",
265
- "brown showers",
266
- "brunette action",
267
- "bukkake",
268
- "bulldyke",
269
- "bullet vibe",
270
- "bullshit",
271
- "bung hole",
272
- "bunghole",
273
- "busty",
274
- "butt",
275
- "buttcheeks",
276
- "butthole",
277
- "camel toe",
278
- "camgirl",
279
- "camslut",
280
- "camwhore",
281
- "carpet muncher",
282
- "carpetmuncher",
283
- "chocolate rosebuds",
284
- "cialis",
285
- "circlejerk",
286
- "cleveland steamer",
287
- "clit",
288
- "clitoris",
289
- "clover clamps",
290
- "clusterfuck",
291
- "cock",
292
- "cocks",
293
- "coprolagnia",
294
- "coprophilia",
295
- "cornhole",
296
- "coon",
297
- "coons",
298
- "creampie",
299
- "cum",
300
- "cumming",
301
- "cumshot",
302
- "cumshots",
303
- "cunnilingus",
304
- "cunt",
305
- "darkie",
306
- "date rape",
307
- "daterape",
308
- "deep throat",
309
- "deepthroat",
310
- "dendrophilia",
311
- "dick",
312
- "dildo",
313
- "dingleberry",
314
- "dingleberries",
315
- "dirty pillows",
316
- "dirty sanchez",
317
- "doggie style",
318
- "doggiestyle",
319
- "doggy style",
320
- "doggystyle",
321
- "dog style",
322
- "dolcett",
323
- "domination",
324
- "dominatrix",
325
- "dommes",
326
- "donkey punch",
327
- "double dong",
328
- "double penetration",
329
- "dp action",
330
- "dry hump",
331
- "dvda",
332
- "eat my ass",
333
- "ecchi",
334
- "ejaculation",
335
- "erotic",
336
- "erotism",
337
- "escort",
338
- "eunuch",
339
- "fag",
340
- "faggot",
341
- "fecal",
342
- "felch",
343
- "fellatio",
344
- "feltch",
345
- "female squirting",
346
- "femdom",
347
- "figging",
348
- "fingerbang",
349
- "fingering",
350
- "fisting",
351
- "foot fetish",
352
- "footjob",
353
- "frotting",
354
- "fuck",
355
- "fuck buttons",
356
- "fuckin",
357
- "fucking",
358
- "fucktards",
359
- "fudge packer",
360
- "fudgepacker",
361
- "futanari",
362
- "gangbang",
363
- "gang bang",
364
- "gay sex",
365
- "genitals",
366
- "giant cock",
367
- "girl on",
368
- "girl on top",
369
- "girls gone wild",
370
- "goatcx",
371
- "goatse",
372
- "god damn",
373
- "gokkun",
374
- "golden shower",
375
- "goodpoop",
376
- "goo girl",
377
- "goregasm",
378
- "grope",
379
- "group sex",
380
- "g-spot",
381
- "guro",
382
- "hand job",
383
- "handjob",
384
- "hard core",
385
- "hardcore",
386
- "hentai",
387
- "homoerotic",
388
- "honkey",
389
- "hooker",
390
- "horny",
391
- "hot carl",
392
- "hot chick",
393
- "how to kill",
394
- "how to murder",
395
- "huge fat",
396
- "humping",
397
- "incest",
398
- "intercourse",
399
- "jack off",
400
- "jail bait",
401
- "jailbait",
402
- "jelly donut",
403
- "jerk off",
404
- "jigaboo",
405
- "jiggaboo",
406
- "jiggerboo",
407
- "jizz",
408
- "juggs",
409
- "kike",
410
- "kinbaku",
411
- "kinkster",
412
- "kinky",
413
- "knobbing",
414
- "leather restraint",
415
- "leather straight jacket",
416
- "lemon party",
417
- "livesex",
418
- "lolita",
419
- "lovemaking",
420
- "make me come",
421
- "male squirting",
422
- "masturbate",
423
- "masturbating",
424
- "masturbation",
425
- "menage a trois",
426
- "milf",
427
- "missionary position",
428
- "mong",
429
- "motherfucker",
430
- "mound of venus",
431
- "mr hands",
432
- "muff diver",
433
- "muffdiving",
434
- "nambla",
435
- "nawashi",
436
- "negro",
437
- "neonazi",
438
- "nigga",
439
- "nigger",
440
- "nig nog",
441
- "nimphomania",
442
- "nipple",
443
- "nipples",
444
- "nsfw",
445
- 'nsfw images',
446
- "nude",
447
- "nudity",
448
- "nutten",
449
- "nympho",
450
- "nymphomania",
451
- "octopussy",
452
- "omorashi",
453
- "one cup two girls",
454
- 'one guy one jar',
455
- "orgasm",
456
- "orgy",
457
- 'paedophile',
458
- "paki",
459
- "panties",
460
- "panty",
461
- "pedobear",
462
- "pedophile",
463
- 'pegging',
464
- 'penis',
465
- "phone sex",
466
- 'piece of shit',
467
- "pikey",
468
- "pissing",
469
- "piss pig",
470
- "pisspig",
471
- "playboy",
472
- "pleasure chest",
473
- "pole smoker",
474
- "ponyplay",
475
- "poof",
476
- "poon",
477
- "poontang",
478
- "punany",
479
- "poop chute",
480
- "poopchute",
481
- "porn",
482
- "porno",
483
- "pornography",
484
- "prince albert piercing",
485
- "pthc",
486
- "pubes",
487
- "pussy",
488
- "queaf",
489
- "queef",
490
- "quim",
491
- "raghead",
492
- "raging boner",
493
- "rape",
494
- "raping",
495
- "rapist",
496
- "rectum",
497
- "reverse cowgirl",
498
- "rimjob",
499
- "rimming",
500
- "rosy palm",
501
- "rosy palm and her 5 sisters",
502
- "rusty trombone",
503
- "sadism",
504
- "santorum",
505
- "scat",
506
- "schlong",
507
- "scissoring",
508
- "semen",
509
- "sex",
510
- "sexcam",
511
- "sexo",
512
- "sexy",
513
- "sexual",
514
- "sexually",
515
- "sexuality",
516
- "shaved beaver",
517
- "shaved pussy",
518
- "shemale",
519
- "shibari",
520
- "shit",
521
- "shitblimp",
522
- "shitty",
523
- "shota",
524
- "shrimping",
525
- "skeet",
526
- "slanteye",
527
- "slut",
528
- "s&m",
529
- "smut",
530
- "snatch",
531
- "snowballing",
532
- "sodomize",
533
- "sodomy",
534
- "spastic",
535
- "spic",
536
- "splooge",
537
- "splooge moose",
538
- "spooge",
539
- "spread legs",
540
- "spunk",
541
- "strap on",
542
- "strapon",
543
- "strappado",
544
- "strip club",
545
- "style doggy",
546
- "suck",
547
- "sucks",
548
- "suicide girls",
549
- "sultry women",
550
- "swastika",
551
- "swinger",
552
- "tainted love",
553
- "taste my",
554
- "tea bagging",
555
- "threesome",
556
- "throating",
557
- "thumbzilla",
558
- "tied up",
559
- "tight white",
560
- "tit",
561
- "tits",
562
- "titties",
563
- "titty",
564
- "topless",
565
- "tosser",
566
- "towelhead",
567
- "tranny",
568
- "tribadism",
569
- "tub girl",
570
- 'tubgirl',
571
- "tushy",
572
- "twat",
573
- "twink",
574
- "twinkie",
575
- "two girls one cup",
576
- "undressing",
577
- 'upskirt',
578
- "urethra play",
579
- "urophilia",
580
- "vagina",
581
- "venus mound",
582
- "viagra",
583
- "vibrator",
584
- "violet wand",
585
- "vorarephilia",
586
- "voyeur",
587
- "voyeurweb",
588
- "voyuer",
589
- "vulva",
590
- "wank",
591
- "wetback",
592
- "wet dream",
593
- "white power",
594
- "whore",
595
- "worldsex",
596
- "wrapping men",
597
- "wrinkled starfish",
598
- "xx",
599
- "xxx",
600
- "yaoi",
601
- "yellow showers",
602
- "yiffy",
603
- "zoophilia",
604
- "anal",
605
- "arousal",
606
- "balls",
607
- "blowjob",
608
- "busty",
609
- "butt",
610
- "cameltoe",
611
- "climax",
612
- "clitoris",
613
- "cock",
614
- "crotch",
615
- "cum",
616
- "cumshot",
617
- "cunnilingus",
618
- "dirty",
619
- "dirtytalk",
620
- "dildo",
621
- "erect",
622
- "erogenous",
623
- "escort",
624
- "explicit",
625
- "facial",
626
- "fetish",
627
- "flirt",
628
- "foreplay",
629
- "genitals",
630
- "groin",
631
- "hardcore",
632
- "hardon",
633
- "horniness",
634
- "horny",
635
- "kamasutra",
636
- "kinky",
637
- "lewd",
638
- "lingerie",
639
- "lust",
640
- "lustful",
641
- "masturbate",
642
- "mature",
643
- "milf",
644
- "naughty",
645
- "naked",
646
- "nipples",
647
- "nude",
648
- "obscene",
649
- "oral",
650
- "orgasm",
651
- "penetration",
652
- "penis",
653
- "pleasure",
654
- "porn",
655
- "prostitute",
656
- "provocative",
657
- "pubic",
658
- "pussy",
659
- "seduce",
660
- "seductive",
661
- "sensual",
662
- "sex",
663
- "sexual",
664
- "sperm",
665
- "strip",
666
- "striptease",
667
- "swinger",
668
- "testicles",
669
- "thong",
670
- "threesome",
671
- "undies",
672
- "undress",
673
- "vagina",
674
- "vibrator",
675
- "wank",
676
- "wet",
677
- "hentai",
678
- "bdsm",
679
- "gay",
680
- "lesbian",
681
- "femboy",
682
- "ass",
683
- ];
684
591
 
592
+ const imageUrl = response?.url || response;
685
593
 
686
-
687
- if (deepCheck) {
688
- if (translatedText.text && nsfwWords.some(word => translatedText.text.includes(word))) {
689
- return message.reply("Warning ⚠️. Your prompt contains **`NSFW/Illegal/Prohibited`** words. Please refrain from doing this.");
690
- }
691
-
692
- if (textToDraw && nsfwWords.some(word => textToDraw.includes(word))) {
693
- return message.reply("Warning ⚠️. Your prompt contains **`NSFW/Illegal/Prohibited`** words. Please refrain from doing this.");
694
- }
695
- }
696
-
697
594
  if (nsfw) {
698
595
  const textToCheck = await groqAnalyzer({ imgURL: imageUrl, prompt: textToDraw });
699
-
596
+
700
597
  if (textToCheck && nsfwWords.some(word => textToCheck.includes(word))) {
701
- return message.reply("Warning ⚠️. Your prompt contains **`NSFW/Illegal/Prohibited`** words. Please refrain from doing this.");
598
+ return message.reply("Warning ⚠️. Your prompt contains **`NSFW/Illegal/Prohibited`** content. Please refrain from this.");
702
599
  }
703
600
 
704
- if (nsfwKeyWords.length > 0) {
705
-
706
- if (textToCheck && nsfwKeyWords.some(word => textToCheck.includes(word))) {
707
- return message.reply("Warning ⚠️. The generated image contatining nsfw content. Turn off nsfw to send nsfw images.");
708
- }
709
-
710
-
601
+ if (nsfwKeyWords.length > 0 && textToCheck && nsfwKeyWords.some(word => textToCheck.includes(word))) {
602
+ return message.reply("Warning ⚠️. The generated image contains NSFW content. Disable NSFW filter to proceed.");
711
603
  }
712
604
  }
713
605
 
606
+ if (imageModal === "v3") {
607
+ const res = await retry(() => axios.get(response.url, { responseType: "arraybuffer" }));
608
+ const buffferedImage = Buffer.from(res.data, "binary");
714
609
 
715
- const attach = new AttachmentBuilder(
716
- imageUrl,
717
- { name: `image_${_0x4d7fb6 + 1}.png` },
718
- ) as AttachmentData;
719
-
720
- attachData.push(attach);
721
-
722
- const urlButton = new ButtonBuilder()
723
- .setStyle(ButtonStyle.Link)
724
- .setLabel(`Image ${_0x4d7fb6 + 1}`)
725
- .setURL(imageUrl);
726
-
727
- buttonsRow1.push(urlButton);
610
+ const resizedImage = await sharp(buffferedImage)
611
+ .resize({ width: 2048, height: 2048, fit: 'cover' })
612
+ .sharpen({ sigma: 1, m1: 5, m2: 2 })
613
+ .toBuffer();
728
614
 
615
+ const attach = new AttachmentBuilder(resizedImage, { name: `image_${i + 1}.png` });
616
+ attachData.push(attach as any);
617
+ } else {
618
+ const attach = new AttachmentBuilder(imageUrl, { name: `image_${i + 1}.png` });
619
+ attachData.push(attach as any);
729
620
  imageUrls.push(imageUrl);
730
621
  }
731
622
 
732
- await new Promise((resolve) => setTimeout(resolve, 0x7d0));
733
- }
734
-
735
- const selectMenu = new StringSelectMenuBuilder()
736
- .setCustomId("image_processing_select")
737
- .setPlaceholder("Select Image Process");
738
-
739
- const options = [
740
- "Resizing",
741
- "Color Filters",
742
- "Convert Image Extension",
743
- "Brightness",
744
- "Sepia",
745
- "Pixelate",
746
- "Blur",
747
- "Fade",
748
- "Opaque",
749
- "Grayscale",
750
- "Contrast",
751
- ];
623
+ const urlButton = new ButtonBuilder()
624
+ .setStyle(ButtonStyle.Link)
625
+ .setLabel(`Image ${i + 1}`)
626
+ .setURL(imageUrl);
752
627
 
753
- options.forEach((option, index) => {
754
- const selectOption = new StringSelectMenuOptionBuilder()
755
- .setLabel(option)
756
- .setValue(`process_${index + 1}`);
757
-
758
- selectMenu.addOptions(selectOption);
759
- });
760
-
761
- await message.channel?.sendTyping();
762
-
763
- const row1 = new ActionRowBuilder().addComponents(
764
- ...buttonsRow1,
765
- );
766
- const row2 = new ActionRowBuilder().addComponents(selectMenu);
767
-
768
- if (enhancer && enhancer.enhanceModal) {
769
- for (const imageUrl of imageUrls) {
770
- try {
628
+ buttonsRow1.push(urlButton);
629
+ }
771
630
 
772
- if (!imageType.validEnhancers?.includes(enhancer.enhanceModal)) {
773
- return await message.reply({ content: `Invalid enhancer modal (~~${enhancer.enhanceModal}~~). Please check documentation online at apexifyjs.jedi-studio.com.`})
774
- }
631
+ const row1 = new ActionRowBuilder().addComponents(...buttonsRow1);
632
+ const row2 = new ActionRowBuilder().addComponents(new StringSelectMenuBuilder().setCustomId("image_processing_select").setPlaceholder("Select Image Process").addOptions([
633
+ "Resizing", "Color Filters", "Convert Image Extension", "Brightness", "Sepia", "Pixelate", "Blur", "Fade", "Opaque", "Grayscale", "Contrast"
634
+ ].map((option, index) => new StringSelectMenuOptionBuilder().setLabel(option).setValue(`process_${index + 1}`))));
775
635
 
776
- const generateResponse = await sdk.upscale({
777
- resize: enhancer.upscale,
778
- model: enhancer.enhanceModal,
779
- imageUrl,
780
- });
781
-
782
- await message.channel?.sendTyping();
783
-
784
- const generatedJobId = generateResponse.data.job;
785
- const enhancedImageUrl = await checkJobStatus(generatedJobId);
786
-
787
- if (enhancedImageUrl) {
788
- attachData.push(new AttachmentBuilder(
789
- enhancedImageUrl,
790
- { name: `enhanced_image_${imageUrls.indexOf(imageUrl) + 1}.png` },
791
- ) as AttachmentData);
792
- }
793
- } catch (error) {
794
- console.error(`Error enhancing image at URL ${imageUrl}:`, error);
795
- }
796
- }
797
- }
798
- const allRows = [...buttons, row1, row2]
799
636
  RespondMessage = await message.reply({
800
637
  files: attachData,
801
- components: allRows,
802
- allowedMentions: { repliedUser: false },
638
+ components: [...buttons, row1, row2],
639
+ allowedMentions: { repliedUser: false }
803
640
  });
804
641
 
805
642
  return { imageUrls, RespondMessage };
806
643
  } catch (error: any) {
807
644
  console.error("Error in drawImage:", error.message);
808
- if (error.response) {
809
- console.error("Status code:", error.response.status);
810
- console.error("Response data:", error.response.data);
811
- }
812
- message.reply({
813
- content: "An error occurred while processing the images.",
814
- allowedMentions: { repliedUser: false },
815
- });
816
645
  return { imageUrls: [], RespondMessage };
817
646
  }
818
647
  }
819
648
 
820
- async function checkJobStatus(jobId: number | string | any) {
649
+ async function checkJobStatus(jobId: string) {
821
650
  try {
822
651
  const getJobResponse = await sdk.getJob({ jobId });
823
652
  const jobData = getJobResponse.data;
653
+
824
654
  if (jobData.status === "generating" || jobData.status === "queued") {
825
655
  await new Promise((resolve) => setTimeout(resolve, 3000));
826
656
  return checkJobStatus(jobId);
@@ -831,10 +661,9 @@ async function checkJobStatus(jobId: number | string | any) {
831
661
  return null;
832
662
  }
833
663
  } catch (error) {
834
- console.error(error);
664
+ console.error("Error fetching job status:", error);
835
665
  return null;
836
666
  }
837
667
  }
838
668
 
839
-
840
- export { aiImagine };
669
+ export { aiImagine };