@@ -24,6 +24,7 @@ import { MessageManager } from "./messages.ts";
24
24
import channelStateProvider from "./providers/channelState.ts" ;
25
25
import voiceStateProvider from "./providers/voiceState.ts" ;
26
26
import { VoiceManager } from "./voice.ts" ;
27
+ import { prettyConsole } from "../../index.ts" ;
27
28
28
29
export class DiscordClient extends EventEmitter {
29
30
apiToken : string ;
@@ -35,9 +36,7 @@ export class DiscordClient extends EventEmitter {
35
36
36
37
constructor ( runtime : IAgentRuntime ) {
37
38
super ( ) ;
38
- this . apiToken = runtime . getSetting (
39
- "DISCORD_API_TOKEN_" + runtime . character . name . toUpperCase ( )
40
- ) as string ;
39
+ this . apiToken = runtime . getSetting ( "DISCORD_API_TOKEN" ) as string ;
41
40
this . client = new Client ( {
42
41
intents : [
43
42
GatewayIntentBits . Guilds ,
@@ -120,10 +119,7 @@ export class DiscordClient extends EventEmitter {
120
119
try {
121
120
await rest . put (
122
121
Routes . applicationCommands (
123
- this . runtime . getSetting (
124
- "DISCORD_APPLICATION_ID_" +
125
- this . runtime . character . name . toUpperCase ( )
126
- )
122
+ this . runtime . getSetting ( "DISCORD_APPLICATION_ID" )
127
123
) ,
128
124
{ body : commands }
129
125
) ;
@@ -134,16 +130,16 @@ export class DiscordClient extends EventEmitter {
134
130
}
135
131
136
132
private async onClientReady ( readyClient : { user : { tag : any ; id : any } } ) {
137
- console . log ( `Logged in as ${ readyClient . user ?. tag } ` ) ;
138
- console . log ( "Use this URL to add the bot to your server:" ) ;
139
- console . log (
133
+ prettyConsole . success ( `Logged in as ${ readyClient . user ?. tag } ` ) ;
134
+ prettyConsole . success ( "Use this URL to add the bot to your server:" ) ;
135
+ prettyConsole . success (
140
136
`https://discord.com/api/oauth2/authorize?client_id=${ readyClient . user ?. id } &permissions=0&scope=bot%20applications.commands`
141
137
) ;
142
138
await this . onReady ( ) ;
143
139
}
144
140
145
141
async handleReactionAdd ( reaction : MessageReaction , user : User ) {
146
- console . log ( "Reaction added" ) ;
142
+ prettyConsole . log ( "Reaction added" ) ;
147
143
// if (user.bot) return;
148
144
149
145
let emoji = reaction . emoji . name ;
0 commit comments