Files
2026-08-21 15:52:36 +02:00

26 lines
789 B
C#

using System;
using System.Threading.Tasks;
using Discord;
using Discord.WebSocket;
public static class VocalManager
{
public static async Task ConnectToVoiceChannelAsync(DiscordSocketClient client, ulong guildId, ulong vocalId)
{
var guild = client.GetGuild(guildId);
if (guild == null)
{
throw new InvalidOperationException($"Guild with ID {guildId} not found.");
}
var channel = guild.GetVoiceChannel(vocalId);
if (channel == null)
{
throw new InvalidOperationException($"Voice channel with ID {vocalId} not found.");
}
await channel.ConnectAsync();
Console.WriteLine($"[Voice] Successfully connected to voice channel '{channel.Name}' in guild '{guild.Name}'.");
}
}