This repository has been archived on 2024-12-22. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
elliebot/src/EllieBot/Modules/Administration/GameVoiceChannel/GameVoiceChannelCommands.cs

36 lines
1 KiB
C#
Raw Normal View History

2024-09-21 00:13:18 +12:00
#nullable disable
using EllieBot.Modules.Administration.Services;
namespace EllieBot.Modules.Administration;
public partial class Administration
{
[Group]
public partial class GameVoiceChannelCommands : EllieModule<GameVoiceChannelService>
{
[Cmd]
[RequireContext(ContextType.Guild)]
[UserPerm(GuildPerm.Administrator)]
[BotPerm(GuildPerm.MoveMembers)]
public async Task GameVoiceChannel()
{
var vch = ((IGuildUser)ctx.User).VoiceChannel;
if (vch is null)
{
await Response().Error(strs.not_in_voice).SendAsync();
return;
}
var id = _service.ToggleGameVoiceChannel(ctx.Guild.Id, vch.Id);
if (id is null)
await Response().Confirm(strs.gvc_disabled).SendAsync();
else
{
_service.GameVoiceChannels.Add(vch.Id);
await Response().Confirm(strs.gvc_enabled(Format.Bold(vch.Name))).SendAsync();
}
}
}
}