Skip to content

Commit 5626f0a

Browse files
committed
chore(ai,xp): updated for v0.11 usage
1 parent 788eeee commit 5626f0a

File tree

21 files changed

+64
-54
lines changed

21 files changed

+64
-54
lines changed

packages/@robojs/ai/src/api/ai/chat.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/** API endpoint for executing chat requests via the AI engine. */
22
import { AI } from '@/core/ai.js'
33
import { logger } from '@/core/logger.js'
4-
import { options as pluginOptions } from '@/events/_start.js'
4+
import { options as pluginOptions } from '@/robo/start.js'
55
import type { ChatMessage } from '@/engines/base.js'
66
import type { RoboRequest } from '@robojs/server'
77

packages/@robojs/ai/src/core/chat/message-utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/** Utility helpers for formatting chat command names and arguments for display. */
2-
import type { Command } from 'robo.js'
2+
import type { Command } from '@robojs/discordjs'
33

44
/**
55
* Converts a command name into a readable display label by replacing separators, handling

packages/@robojs/ai/src/core/tool-executor.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ import type {
2424
User
2525
} from 'discord.js'
2626
import { ComponentType } from 'discord.js'
27-
import { Command, color, getConfig } from 'robo.js'
28-
import type { SageOptions } from 'robo.js'
27+
import { color, getPluginOptions } from 'robo.js'
2928
import { extractCommandOptions } from '@robojs/discordjs'
3029
import { mockInteraction } from '@/utils/discord-utils.js'
30+
import type { Command, DiscordConfig, SageOptions } from '@robojs/discordjs'
3131

3232
/**
3333
* Extends {@link ChatReply} with command execution metadata for downstream processing.
@@ -526,9 +526,9 @@ const DEFAULT_SAGE_OPTIONS: Required<Pick<SageOptions, 'defer' | 'deferBuffer' |
526526
* Merges global and command-level Sage configuration, giving precedence to command overrides.
527527
*/
528528
function resolveSageOptions(command: Command): SageOptions {
529-
const config = getConfig()
529+
const pluginConfig = getPluginOptions('@robojs/discordjs') as unknown as DiscordConfig
530530
const commandSage = command.config?.sage
531-
const configSage = config?.sage
531+
const configSage = pluginConfig?.sage
532532

533533
if (commandSage === false || (commandSage === undefined && configSage === false)) {
534534
return {

packages/@robojs/ai/src/engines/base.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*/
66
import type { ChatReply } from '../core/chat/types.js'
77
import type { GuildMember, TextBasedChannel, User, VoiceBasedChannel } from 'discord.js'
8-
import type { Command } from 'robo.js'
8+
import type { Command } from '@robojs/discordjs'
99

1010
/**
1111
* Enumerates feature flags describing the optional capabilities an engine exposes.

packages/@robojs/ai/src/engines/openai/engine.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ import type {
4545
} from 'openai/resources/responses/responses'
4646
import { Flashcore, color, portal } from 'robo.js'
4747
import { getClient } from '@robojs/discordjs'
48-
import type { Command } from 'robo.js'
48+
import type { Command } from '@robojs/discordjs'
4949
import { ImagesResponse } from 'openai/resources/images.js'
5050
import type { ReasoningEffort, ResponsesModel } from 'openai/resources/shared.js'
5151
import { incrementRealtimeReconnects, incrementFailedFrameAppends } from '@/core/voice/metrics.js'

packages/@robojs/ai/src/utils/discord-utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import type {
1919
MessagePayload,
2020
Role
2121
} from 'discord.js'
22-
import type { CommandOption } from 'robo.js'
22+
import type { CommandOption } from '@robojs/discordjs'
2323

2424
/** Lifecycle callbacks invoked during the mock interaction flow. */
2525
interface MockInteractionCallbacks {

packages/@robojs/ai/tsconfig.json

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,7 @@
33
"baseUrl": ".",
44
"paths": {
55
"@robojs/ai": ["src/index.ts"],
6-
"@/api/*": ["src/api/*"],
7-
"@/commands/*": ["src/commands/*"],
8-
"@/core/*": ["src/core/*"],
9-
"@/engines/*": ["src/engines/*"],
10-
"@/events/*": ["src/events/*"],
11-
"@/utils/*": ["src/utils/*"]
6+
"@/*": ["src/*"]
127
},
138
"target": "ES2021",
149
"lib": ["es2021", "DOM"],
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export default {}

packages/@robojs/xp/src/api/xp/health.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import type { RoboRequest } from '@robojs/server'
2-
import { client, logger } from 'robo.js'
2+
import { logger } from 'robo.js'
3+
import { getClient } from '@robojs/discordjs'
34
import { wrapHandler, success, validateMethod } from './utils.js'
45

56
const apiLogger = logger.fork('xp-api')
@@ -28,6 +29,7 @@ export default wrapHandler(async (request: RoboRequest) => {
2829

2930
try {
3031
// Check Discord client status
32+
const client = getClient()
3133
const discordReady = client.isReady()
3234
const guildCount = client.guilds.cache.size
3335

packages/@robojs/xp/src/api/xp/utils.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import type { RoboRequest } from '@robojs/server'
2-
import { client, logger } from 'robo.js'
2+
import { logger } from 'robo.js'
3+
import { getClient } from '@robojs/discordjs'
34
import type { Guild } from 'discord.js'
45

56
const apiLogger = logger.fork('xp-api')
@@ -59,7 +60,7 @@ export async function getGuildFromRequest(request: RoboRequest): Promise<Guild>
5960
throw error
6061
}
6162

62-
const guild = await client.guilds.fetch(guildId).catch(() => null)
63+
const guild = await getClient().guilds.fetch(guildId).catch(() => null)
6364
if (!guild) {
6465
const error = new Error('Guild not found or bot not member')
6566
;(error as Error & { code: string }).code = ERROR_CODES.GUILD_NOT_FOUND

0 commit comments

Comments
 (0)