Skip to content

Commit 4ebb802

Browse files
authored
Merge branch 'develop' into main
2 parents 92e936f + 5eb5514 commit 4ebb802

File tree

3 files changed

+25
-10
lines changed

3 files changed

+25
-10
lines changed

Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,4 +52,4 @@ COPY --from=builder /app/scripts ./scripts
5252
COPY --from=builder /app/characters ./characters
5353

5454
# Set the command to run the application
55-
CMD ["pnpm", "start", "--non-interactive"]
55+
CMD ["pnpm", "start"]

agent/src/index.ts

+6-5
Original file line numberDiff line numberDiff line change
@@ -648,14 +648,15 @@ const startAgents = async () => {
648648
}
649649

650650
// upload some agent functionality into directClient
651-
directClient.startAgent = async character => {
652-
// wrap it so we don't have to inject directClient later
653-
return startAgent(character, directClient)
651+
directClient.startAgent = async (character) => {
652+
// wrap it so we don't have to inject directClient later
653+
return startAgent(character, directClient);
654654
};
655655
directClient.start(serverPort);
656656

657-
elizaLogger.log("Visit the following URL to chat with your agents:");
658-
elizaLogger.log(`http://localhost:5173`);
657+
elizaLogger.log(
658+
"Run `pnpm start:client` to start the client and visit the outputted URL (http://localhost:5173) to chat with your agents"
659+
);
659660
};
660661

661662
startAgents().catch((error) => {

packages/client-discord/src/voice.ts

+18-4
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import {
2525
VoiceConnectionStatus,
2626
createAudioPlayer,
2727
createAudioResource,
28-
getVoiceConnection,
28+
getVoiceConnections,
2929
joinVoiceChannel,
3030
entersState,
3131
} from "@discordjs/voice";
@@ -194,7 +194,9 @@ export class VoiceManager extends EventEmitter {
194194
}
195195

196196
async joinChannel(channel: BaseGuildVoiceChannel) {
197-
const oldConnection = getVoiceConnection(channel.guildId as string);
197+
const oldConnection = this.getVoiceConnection(
198+
channel.guildId as string
199+
);
198200
if (oldConnection) {
199201
try {
200202
oldConnection.destroy();
@@ -212,6 +214,7 @@ export class VoiceManager extends EventEmitter {
212214
adapterCreator: channel.guild.voiceAdapterCreator as any,
213215
selfDeaf: false,
214216
selfMute: false,
217+
group: this.client.user.id,
215218
});
216219

217220
try {
@@ -328,14 +331,25 @@ export class VoiceManager extends EventEmitter {
328331
}
329332
}
330333

334+
private getVoiceConnection(guildId: string) {
335+
const connections = getVoiceConnections(this.client.user.id);
336+
if (!connections) {
337+
return;
338+
}
339+
const connection = [...connections.values()].find(
340+
(connection) => connection.joinConfig.guildId === guildId
341+
);
342+
return connection;
343+
}
344+
331345
private async monitorMember(
332346
member: GuildMember,
333347
channel: BaseGuildVoiceChannel
334348
) {
335349
const userId = member?.id;
336350
const userName = member?.user?.username;
337351
const name = member?.user?.displayName;
338-
const connection = getVoiceConnection(member?.guild?.id);
352+
const connection = this.getVoiceConnection(member?.guild?.id);
339353
const receiveStream = connection?.receiver.subscribe(userId, {
340354
autoDestroy: true,
341355
emitClose: true,
@@ -1069,7 +1083,7 @@ export class VoiceManager extends EventEmitter {
10691083
}
10701084

10711085
async handleLeaveChannelCommand(interaction: any) {
1072-
const connection = getVoiceConnection(interaction.guildId as any);
1086+
const connection = this.getVoiceConnection(interaction.guildId as any);
10731087

10741088
if (!connection) {
10751089
await interaction.reply("Not currently in a voice channel.");

0 commit comments

Comments
 (0)