add discord bot

change net6.0 net7.0
This commit is contained in:
Дмитрий Шиманский
2023-10-26 11:35:42 +03:00
parent 7c6fafa9e6
commit 9a8a4cad5d
35 changed files with 1132 additions and 37 deletions

View File

@@ -0,0 +1,33 @@
using Discord.Interactions;
namespace DiscordApp.Justice.Interactions
{
public class VerificateInteraction : InteractionModuleBase<SocketInteractionContext>
{
[ComponentInteraction("UserVerification")]
public async Task userVerificationInteraction()
{
await DeferAsync(true);
try
{
var user = await Startup.sp.GetUser(Context.User.Id.ToString());
if (user.IsPlayer())
{
await FollowupAsync("Готово!", ephemeral: true);
var guildUser = Context.Guild.GetUser(Context.User.Id);
await guildUser.AddRoleAsync(1165687128366268511);
await guildUser.ModifyAsync(func =>
{
func.Nickname = user.Name;
});
}
}
catch (Exception ex)
{
await Console.Out.WriteLineAsync($"User {Context.User.GlobalName} not found! Error: {ex.Message}");
await FollowupAsync("Какая-то ошибка, возможно вы не игрок пупленда...", ephemeral: true);
}
}
}
}