Skip to content

Commit 499ad36

Browse files
committed
add /i command
1 parent bb8833f commit 499ad36

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

src/modules/open-ai/helpers.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,18 @@ export const SupportedCommands = {
1616
ask32: { name: 'ask32' },
1717
gpt: { name: 'gpt' },
1818
last: { name: 'last' },
19-
dalle: { name: 'image' },
19+
dalle: { name: 'dalle' },
20+
dalleImg: { name: 'image' },
2021
dalleShort: { name: 'img' },
22+
dalleShorter: { name: 'i' },
2123
genImgEn: { name: 'genImgEn' },
2224
on: { name: 'on' },
2325
off: { name: 'off' }
2426
}
2527

2628
export const MAX_TRIES = 3
2729

28-
const DALLE_PREFIX_LIST = ['i.', ', ', 'image ', 'd.', 'img ']
30+
const DALLE_PREFIX_LIST = ['i. ', ',', 'image ', 'd.', 'img ', 'i ']
2931

3032
export const isMentioned = (
3133
ctx: OnMessageContext | OnCallBackQueryData

src/modules/open-ai/index.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,10 @@ export class OpenAIBot implements PayableBot {
101101
return 0
102102
}
103103
if (
104-
ctx.hasCommand(SupportedCommands.dalle.name) ||
105-
ctx.hasCommand(SupportedCommands.dalleShort.name)
104+
ctx.hasCommand([SupportedCommands.dalle.name,
105+
SupportedCommands.dalleImg.name,
106+
SupportedCommands.dalleShort.name,
107+
SupportedCommands.dalleShorter.name])
106108
) {
107109
const imageNumber = ctx.session.openAi.imageGen.numImages
108110
const imageSize = ctx.session.openAi.imageGen.imgSize
@@ -227,7 +229,10 @@ export class OpenAIBot implements PayableBot {
227229
}
228230

229231
if (
230-
ctx.hasCommand([SupportedCommands.dalle.name, SupportedCommands.dalleShort.name]) ||
232+
ctx.hasCommand([SupportedCommands.dalle.name,
233+
SupportedCommands.dalleImg.name,
234+
SupportedCommands.dalleShort.name,
235+
SupportedCommands.dalleShorter.name]) ||
231236
(ctx.message?.text?.startsWith('image ') && ctx.chat?.type === 'private')
232237
) {
233238
let prompt = (ctx.match ? ctx.match : ctx.message?.text) as string

0 commit comments

Comments
 (0)