diff --git a/Content.DiscordBot/VerificationModule.cs b/Content.DiscordBot/UsersModule.cs similarity index 50% rename from Content.DiscordBot/VerificationModule.cs rename to Content.DiscordBot/UsersModule.cs index c31350bba2..8756c5e249 100644 --- a/Content.DiscordBot/VerificationModule.cs +++ b/Content.DiscordBot/UsersModule.cs @@ -1,4 +1,5 @@ using Content.Server.Database; +using Discord; using Discord.Interactions; using Robust.Shared.IoC; using Robust.Shared.Log; @@ -6,17 +7,17 @@ namespace Content.DiscordBot; -public sealed partial class VerificationModule : InteractionModuleBase +public sealed partial class UsersModule : InteractionModuleBase { [Dependency] private readonly IServerDbManager _db = default!; - public static readonly ISawmill Log = LogHelper.GetLogger("discord.interaction_handling"); + public static readonly ISawmill Log = LogHelper.GetLogger("discord.users_module"); public override void BeforeExecute(ICommandInfo command) { DiscordIoC.InjectDependencies(this); } - [SlashCommand("verify", "Проверифицируйте свой аккаунт")] + [SlashCommand("привязать", "Привяжите свой аккаунт Discord к аккаунту SS14")] [RequireContext(ContextType.Guild)] public async Task VerifyCommand(string verificationCode) { @@ -31,4 +32,26 @@ public async Task VerifyCommand(string verificationCode) await _db.LinkDiscord(new NetUserId((Guid) player), Context.User.Id); await RespondAsync("Ваш аккаунт Discord успешно привязан!"); } + + [SlashCommand("призвать", "Призовите игрока")] + [RequireContext(ContextType.Guild)] + [RequireUserPermission(GuildPermission.MentionEveryone)] + public async Task SummonCommand(string ckey) + { + var player = await _db.GetPlayerRecordByUserName(ckey); + + if (player == null) + { + await RespondAsync("❗ Пользователя с таким CKey не существует в нашей базе данных"); + return; + } + + if (player.DiscordId == null) + { + await RespondAsync("❗ У данного пользователя отсутствует привязанный профиль Discord"); + return; + } + + await RespondAsync($"👉 <@!{player.DiscordId}>"); + } }