mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-01 08:20:08 +00:00
26 lines
731 B
TypeScript
26 lines
731 B
TypeScript
import { ChannelTypes } from "../../mod.ts";
|
|
import { assertEquals } from "../deps.ts";
|
|
import { bot, guild } from "../mod.ts";
|
|
import { delayUntil } from "../utils.ts";
|
|
|
|
Deno.test("[channel] Connect to voice channel.", async () => {
|
|
const channel = await bot.helpers.createChannel(guild.id, {
|
|
name: "lumap",
|
|
type: ChannelTypes.GuildVoice,
|
|
});
|
|
|
|
let joined = false;
|
|
|
|
bot.events.voiceStateUpdate = function (bot, voiceState) {
|
|
if (voiceState.userId !== bot.id) return;
|
|
joined = voiceState.channelId === channel.id;
|
|
};
|
|
|
|
// CONNECT BOT
|
|
await bot.helpers.connectToVoiceChannel(guild.id, channel.id);
|
|
// WAIT FOR EVENT TO ARRIVE
|
|
await delayUntil(10000, () => joined);
|
|
|
|
assertEquals(joined, true);
|
|
});
|