コード例 #1
0
ファイル: ProfileModule.cs プロジェクト: DavidXLiu/Kamtro-Bot
        private async Task AddRep(SocketUser user)
        {
            if (user.Id == Context.User.Id)
            {
                await ReplyAsync(BotUtils.KamtroText("You can't give a repuation point to yourself!"));

                return;
            }

            // Change formatting based on nicknames and channel
            SocketGuildUser targetGuildUser = BotUtils.GetGUser(user.Id);
            SocketGuildUser currentUser     = BotUtils.GetGUser(Context);

            await UserDataManager.AddRep(currentUser, targetGuildUser);

            // Notify user if they have notification on
            if (UserDataManager.GetUserSettings(targetGuildUser).RepNotify)
            {
                await targetGuildUser.SendMessageAsync(BotUtils.KamtroText($"You have received a reputation point from {currentUser.GetDisplayName()}."));
            }

            if (Context.Channel is SocketDMChannel)
            {
                await ReplyAsync(BotUtils.KamtroText($"You have given a reputation point to {targetGuildUser.GetDisplayName()}."));
            }
            else
            {
                SocketGuildUser guildUser = BotUtils.GetGUser(Context);

                await ReplyAsync(BotUtils.KamtroText($"{guildUser.GetDisplayName()} has given a reputation point to {targetGuildUser.GetDisplayName()}."));
            }
        }