Skip to content

Commit df42dc6

Browse files
committed
Add buy-credits command to make it more obvious how to do this
1 parent 0fd1759 commit df42dc6

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

cli/src/commands/command-registry.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import open from 'open'
2+
13
import { handleAdsEnable, handleAdsDisable } from './ads'
24
import { handleHelpCommand } from './help'
35
import { handleImageCommand } from './image'
@@ -6,6 +8,7 @@ import { handleReferralCode } from './referral'
68
import { runBashCommand } from './router'
79
import { normalizeReferralCode } from './router-utils'
810
import { handleUsageCommand } from './usage'
11+
import { WEBSITE_URL } from '../login/constants'
912
import { useChatStore } from '../state/chat-store'
1013
import { useFeedbackStore } from '../state/feedback-store'
1114
import { useLoginStore } from '../state/login-store'
@@ -375,6 +378,14 @@ export const COMMAND_REGISTRY: CommandDefinition[] = [
375378
clearInput(params)
376379
},
377380
}),
381+
defineCommand({
382+
name: 'buy-credits',
383+
handler: (params) => {
384+
open(WEBSITE_URL + '/profile?tab=usage')
385+
// Don't save to history.
386+
clearInput(params)
387+
},
388+
}),
378389
defineCommandWithArgs({
379390
name: 'image',
380391
aliases: ['img', 'attach'],

cli/src/data/slash-commands.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,11 @@ export const SLASH_COMMANDS: SlashCommand[] = [
6969
description: 'View credits and subscription quota',
7070
aliases: ['credits'],
7171
},
72+
{
73+
id: 'buy-credits',
74+
label: 'buy-credits',
75+
description: 'Open the usage page to buy credits',
76+
},
7277
{
7378
id: 'new',
7479
label: 'new',

0 commit comments

Comments
 (0)