예제 #1
0
        public static async Task CheckUsername(SocketUser before, SocketUser after)
        {
            try
            {
                if (before.Username != after.Username)
                {
                    var channel = (ITextChannel)Client.GetChannel(85842104034541568);
                    if (channel != null)
                    {
                        await channel.SendMessageAsync($"{before.Username} changed his name to {after.Username}.")
                        .ConfigureAwait(false);

                        WhoIsService.AddWhoIs(before, after);
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex + "\r\n" + ex.Message);
            }
        }
예제 #2
0
        public static async Task CheckNickname(SocketGuildUser before, SocketGuildUser after)
        {
            try
            {
                if (before?.Guild.Id == 85814946004238336)
                {
                    var channel = (ITextChannel)Client.GetChannel(85842104034541568);
                    if (channel != null && before.Nickname != after.Nickname)
                    {
                        if (before.Nickname != null && after.Nickname != null)
                        {
                            await channel.SendMessageAsync(
                                $"{before.Nickname} changed his nickname to {after.Nickname}.")
                            .ConfigureAwait(false);

                            WhoIsService.AddWhoIs(before, after.Nickname);
                        }
                        else if (before.Nickname == null && after.Nickname != null)
                        {
                            await channel
                            .SendMessageAsync($"{before.Username} set his nickname to {after.Nickname}.")
                            .ConfigureAwait(false);

                            WhoIsService.AddWhoIs(before, after.Nickname);
                        }
                        else
                        {
                            await channel.SendMessageAsync($"{before.Username} reset his nickname.")
                            .ConfigureAwait(false);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex + "\r\n" + ex.Message);
            }
        }