internal static async void UserSendMessage(SocketUser user) { UserExpMute account = UsersExpMute.GetExpMute(user.Id); account.XP += 50; UsersExpMute.Save(); }
public async Task GiveXP(SocketGuildUser user, ulong amount) { UserExpMute account = UsersExpMute.GetExpMute(user.Id); account.XP += amount; UsersExpMute.Save(); await Context.Channel.SendMessageAsync($"Dodano użytkownikowi {user.Mention} {amount} XP"); }
private static UserExpMute CreateUserExpMute(ulong id) { UserExpMute nicks = new UserExpMute() { ID = id }; _usersExp.Add(nicks); Save(); return(nicks); }
public async Task Mute(SocketGuildUser user, bool mute) { GuildCfg guildCfg = GuildsCfgs.GetGuildCfg(Context.Guild); ISocketMessageChannel modChannel = (ISocketMessageChannel)Methods.GetTextChannelByID(Context.Guild, guildCfg.ModeratorChannelID); UserExpMute account = UsersExpMute.GetExpMute(user.Id); account.IsMuted = mute; UsersExpMute.Save(); await modChannel.SendMessageAsync($"Pomyślnie zmieniono możliwość swobodnej wypowiedzi użytkownikowi {user.Mention} na: {!account.IsMuted}."); }
private static UserExpMute GetUserExpMute(ulong id) { IEnumerable <UserExpMute> result = from u in _usersExp where u.ID == id select u; UserExpMute nicks = result.FirstOrDefault(); if (nicks == null) { nicks = CreateUserExpMute(id); } return(nicks); }
private async Task HandleCommandAsync(SocketMessage s) { try { var msg = s as SocketUserMessage; if (msg == null) { return; } var context = new SocketCommandContext(_client, msg); UserExpMute author = UsersExpMute.GetExpMute(msg.Author.Id); if (author.IsMuted) { await msg.DeleteAsync(); return; } //Leveling up Leveling.UserSendMessage(context.User); int argPos = 0; if (msg.HasStringPrefix(Config.bot.cmdPrefix, ref argPos) || msg.HasMentionPrefix(_client.CurrentUser, ref argPos)) { var result = await _commands.ExecuteAsync(context, argPos, _service); if (!result.IsSuccess && result.Error != CommandError.UnknownCommand) { Console.WriteLine(result.ErrorReason); } } } catch (Exception ex) { Console.WriteLine(ex); throw; } }
public async Task CheckStatus(SocketUser user = null) { if (user == null) { user = Context.User; } UserExpMute userExp = UsersExpMute.GetExpMute(user.Id); UserPraises uPraises = UsersPraises.GetUserPraises(user.Id); UserArchievements uArchievements = UsersArchievements.GetUserArchievements(user.Id); UserWarnings accountWarns = UsersWarnings.GetUserWarnings(user); Methods.DeleteExpiredWarnings(accountWarns); string archievements = "Osiągnięcia:\n"; foreach (string item in uArchievements.Archievements) { archievements += $"{item}\n"; } await Context.Channel.SendMessageAsync($"{user.Username} ma {userExp.LevelNumber} lvl, {userExp.XP} xp. Został pochwalony {uPraises.Praises.Count} razy oraz otrzymał {accountWarns.Warnings.Count} ostrzeżeń.\n{archievements}"); }