Skip to content

Commit c0915e7

Browse files
discord env
1 parent 3b05a1a commit c0915e7

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

core/src/clients/discord/index.ts

+7-11
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import { MessageManager } from "./messages.ts";
2424
import channelStateProvider from "./providers/channelState.ts";
2525
import voiceStateProvider from "./providers/voiceState.ts";
2626
import { VoiceManager } from "./voice.ts";
27+
import { prettyConsole } from "../../index.ts";
2728

2829
export class DiscordClient extends EventEmitter {
2930
apiToken: string;
@@ -35,9 +36,7 @@ export class DiscordClient extends EventEmitter {
3536

3637
constructor(runtime: IAgentRuntime) {
3738
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;
4140
this.client = new Client({
4241
intents: [
4342
GatewayIntentBits.Guilds,
@@ -120,10 +119,7 @@ export class DiscordClient extends EventEmitter {
120119
try {
121120
await rest.put(
122121
Routes.applicationCommands(
123-
this.runtime.getSetting(
124-
"DISCORD_APPLICATION_ID_" +
125-
this.runtime.character.name.toUpperCase()
126-
)
122+
this.runtime.getSetting("DISCORD_APPLICATION_ID")
127123
),
128124
{ body: commands }
129125
);
@@ -134,16 +130,16 @@ export class DiscordClient extends EventEmitter {
134130
}
135131

136132
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(
140136
`https://discord.com/api/oauth2/authorize?client_id=${readyClient.user?.id}&permissions=0&scope=bot%20applications.commands`
141137
);
142138
await this.onReady();
143139
}
144140

145141
async handleReactionAdd(reaction: MessageReaction, user: User) {
146-
console.log("Reaction added");
142+
prettyConsole.log("Reaction added");
147143
// if (user.bot) return;
148144

149145
let emoji = reaction.emoji.name;

0 commit comments

Comments
 (0)