public async Task CheckRoles() { var guildid = Context.Guild.Id; var userList = Program.Client.GetGuild(guildid).Users; try { var list = service.FindPlayersWithNoRoles(); list.ForEach(o => { var ulist = userList.GetEnumerator(); while (ulist.MoveNext()) { var user = ulist.Current; if (user.Username + "#" + user.Discriminator == o.DiscordName) { UserExtensions.SendMessageAsync(user, $"Beep Boop you have not selected any roles for {o.IngameName}, it is easily done with !AddRole {o.IngameName} - Role, thanks in advance"); break; } } }); } catch (Exception e) { await Context.Channel.SendMessageAsync(e.Message); var lm = new LogMessageService(); await lm.CreateLogEntry(e.Message, e.StackTrace); } }
public async Task GetAllPlayers() { var channel = await Context.User.GetOrCreateDMChannelAsync(); try { var list = service.GetAll(Context.Guild.Id.ToString()); var embedPlayerListe = new List <Player>(); var embedListe = new List <EmbedBuilder>(); var count = 0; var embedcount = -1; list.ForEach(o => { if (count % 25 == 0) { embedListe.Add(new EmbedBuilder().WithTitle("All players - Count:" + list.Count)); embedcount++; } embedListe[embedcount].AddField(o.IngameName, "Ilvl: " + o.Ilvl + " - Role(s): " + Helpers.GetRoleFromList(o.Roles) + " - Cloak level: " + o.CloakLevel + " - M+ Score: " + o.MythicScore); count++; }); embedListe.ForEach(async o => { await channel.SendMessageAsync("", false, o.Build()); }); } catch (Exception e) { await channel.SendMessageAsync(e.Message); var lm = new LogMessageService(); await lm.CreateLogEntry(e.Message, e.StackTrace); } }
public async Task GetAllCommands() { try { var list = await service.GetAll(); var embedListe = new List <EmbedBuilder>(); var embedcount = -1; var count = 0; list.ForEach(o => { if (count % 25 == 0) { embedListe.Add(new EmbedBuilder().WithTitle("Commands")); embedcount++; } embedListe[embedcount].AddField(o.Id + " - " + o.Cmd, o.CmdText); count++; }); var channel = await Context.User.GetOrCreateDMChannelAsync(); embedListe.ForEach(async o => await channel.SendMessageAsync("", false, o.Build())); } catch (Exception e) { await Context.Channel.SendMessageAsync(e.Message); var lm = new LogMessageService(); await lm.CreateLogEntry(e.Message, e.StackTrace); } }
public async Task UpdateAll() { try { service.UpdateAll(); } catch (Exception e) { await Context.Channel.SendMessageAsync(e.Message); var lm = new LogMessageService(); await lm.CreateLogEntry(e.Message, e.StackTrace); } }
public async Task GetSignupsForSpecificRaid(int id) { try { var signUpList = service.GetAllForSpecificRaid(id, Context.Guild.Id.ToString()); var embedList = new List <EmbedBuilder>(); int count = 1; int embedCount = 0; var tankCount = 0; var healerCount = 0; var dpsCount = 0; embedList.Add(new EmbedBuilder()); signUpList.ForEach(async o => { if (o != null) { var player = playerService.GetSpecificPlayer(o.PlayerId); if (player.Roles.Contains(Role.Tank)) { tankCount++; } else if (player.Roles.Contains(Role.Healer)) { healerCount++; } else { dpsCount++; } embedList[embedCount].AddField(player.IngameName, player.PClass + " - " + player.Ilvl + " - " + Helpers.GetRoleFromList(player.Roles) + " - CloakLevel:" + player.CloakLevel); if (count % 24 == 0) { embedList.Add(new EmbedBuilder()); embedCount++; } count++; } }); embedList[0].WithTitle("Total signups: " + signUpList.Count + " Tanks: " + tankCount + " Healers: " + healerCount + " Dps: " + dpsCount); embedList.ForEach(async o => await Context.Channel.SendMessageAsync("", false, o.Build())); } catch (ArgumentException e) { await Context.Channel.SendMessageAsync(e.Message); var lm = new LogMessageService(); await lm.CreateLogEntry(e.Message, e.StackTrace); } }
public async Task AddKey([Remainder] string input) { try { ks.CreateKeyFromStringAndSave(input, Context.Message.Author.ToString()); await Context.Channel.SendMessageAsync("Done"); } catch (FormatException e) { await Context.Channel.SendMessageAsync(e.Message); var lm = new LogMessageService(); await lm.CreateLogEntry(e.Message, e.StackTrace); } }
public async Task DeletePlayer(string input) { try { service.DeletePlayer(input, Context.Message.Author.Id.ToString(), Context.Guild.Id.ToString()); await Context.Channel.SendMessageAsync("Done amigo"); } catch (Exception e) { await Context.Channel.SendMessageAsync(e.Message); var lm = new LogMessageService(); await lm.CreateLogEntry(e.Message, e.StackTrace); } }
public async Task SetMain(string charName) { try { service.SetMain(charName, Context.Message.Author.Id.ToString(), Context.Guild.Id.ToString()); await Context.Channel.SendMessageAsync("Done amigo"); } catch (Exception e) { await Context.Channel.SendMessageAsync(e.Message); var lm = new LogMessageService(); await lm.CreateLogEntry(e.Message, e.StackTrace); } }
public async Task NotifyChannels() { try { var dif = DateTime.Now.Day - DateTime.Now.AddDays(2).Day; await service.Notify($"@here Everyone who is interested in the friday raid remember to sign up.\nIf you want to raid on your main and it is !setmain, you can signup by using\n!signup RaidId\n otherwise you'll have to use the format:\n!Signup - Character name - RaidId. \nYou can register multiple characters!", "Friday Raid", Context.Channel.Id.ToString()); } catch (Exception e) { await Context.Channel.SendMessageAsync(e.Message); var lm = new LogMessageService(); await lm.CreateLogEntry(e.Message, e.StackTrace); } }
public async Task EditRaid([Remainder] string input) { try { var raid = service.Edit(input, Context.Guild.Id.ToString()); var embed = Helpers.GetEmbed(raid.RaidTitle, "ID:", raid.Id.ToString()).AddField("Date: ", raid.RaidDay.ToString("dd-MM HH:mm")); await Context.Channel.SendMessageAsync("", false, embed.Build()); } catch (Exception e) { await Context.Channel.SendMessageAsync(e.Message + "Use format: !EditRaid RAID TITLE - RaidId - (DD/MM/YYYY HH:MM) date can be left out if no changes are to be made."); var lm = new LogMessageService(); await lm.CreateLogEntry(e.Message, e.StackTrace); } }
public async Task UserJoined(SocketGuildUser user) { try { var channel = await user.GetOrCreateDMChannelAsync(); var emb = new EmbedBuilder(); emb.WithTitle("Welcome amigo!").AddField(user.Username, "Welcome to the guild amigo. I am in charge of making heroics raids. Go to the bot channel to get started or DM me !CMD for help. Have a nice day"); await channel.SendMessageAsync("", false, emb.Build()); } catch (Exception e) { var ms = new LogMessageService(); await ms.CreateLogEntry(e.Message, e.StackTrace); } }
public async Task DeleteCmd(int id) { try { await service.Delete(id); await Context.Channel.SendMessageAsync("Succes"); } catch (Exception e) { await Context.Channel.SendMessageAsync(e.Message); var lm = new LogMessageService(); await lm.CreateLogEntry(e.Message, e.StackTrace); } }
public async Task CreatePredefinedCmd() { try { await service.CreateExistingCommands(); await Context.Channel.SendMessageAsync("Succes"); } catch (Exception e) { await Context.Channel.SendMessageAsync(e.Message); var lm = new LogMessageService(); await lm.CreateLogEntry(e.Message, e.StackTrace); } }
public async Task UpdateCmd([Remainder] string input) { try { await service.Update(input); await Context.Channel.SendMessageAsync("Succes"); } catch (Exception e) { await Context.Channel.SendMessageAsync(e.Message); var lm = new LogMessageService(); await lm.CreateLogEntry(e.Message, e.StackTrace); } }
//[RequireUserPermission(Discord.GuildPermission.ManageChannels)] public async Task CreateRaid([Remainder] string input) { try { var raid = service.Create(input, Context.Message.Author.Id.ToString(), Context.Guild.Id.ToString()); var embed = Helpers.GetEmbed(raid.RaidTitle, "ID:", raid.Id.ToString()).AddField("Date: ", raid.RaidDay.ToString("dd-MM HH:mm")); await Context.Channel.SendMessageAsync("", false, embed.Build()); } catch (Exception e) { await Context.Channel.SendMessageAsync(e.Message + "Use format: !createraid RAID TITLE - MM/DD/YYYY HH:MM"); var lm = new LogMessageService(); await lm.CreateLogEntry(e.Message, e.StackTrace); } }
public async Task Update(string CharName) { try { await service.Update(CharName, Context.Guild.Id.ToString()); await Context.Channel.SendMessageAsync("Done amigo!"); } catch (Exception e) { await Context.Channel.SendMessageAsync(e.Message); var lm = new LogMessageService(); await lm.CreateLogEntry(e.Message, e.StackTrace); } }
public async Task DeleteSignUp(int raidId) { try { service.DeleteSignup(raidId, Context.Message.Author.ToString()); var msg = (RestUserMessage)await Context.Channel.GetMessageAsync(Context.Message.Id); await Helpers.ReactToMessage(msg, DefinedEmojis.Stars); } catch (Exception e) { await Context.Channel.SendMessageAsync(e.Message); var lm = new LogMessageService(); await lm.CreateLogEntry(e.Message, e.StackTrace); } }
public async Task AddRoles() { var channel = await Context.User.GetOrCreateDMChannelAsync(); try { service.AddRoles(); await channel.SendMessageAsync("Done!"); } catch (Exception e) { await channel.SendMessageAsync(e.Message); var lm = new LogMessageService(); await lm.CreateLogEntry(e.Message, e.StackTrace); } }
public async Task RemoveRole([Remainder] string input) { var channel = await Context.User.GetOrCreateDMChannelAsync(); try { service.RemoveRole(input, Context.Message.Author.ToString(), Context.Guild.Id.ToString()); await Context.Channel.SendMessageAsync("Removed role(s) for you!"); } catch (Exception e) { await channel.SendMessageAsync(e.Message); var lm = new LogMessageService(); await lm.CreateLogEntry(e.Message, e.StackTrace); } }
public async Task SplitGroups(int raidId) { try { var channel = await Context.User.GetOrCreateDMChannelAsync(); var embedList = new List <EmbedBuilder>(); int count = 1; int embedCount = -1; int playerCount = 1; var avgList = new List <int>(); var list = new List <List <SignUp> >(); await Task.Run(() => { list = service.SplitGroups(raidId, ref avgList, Context.Guild.Id.ToString()); }); list.ForEach(o => { embedList.Add(new EmbedBuilder().WithTitle("Raid group " + count + " Avg ilvl: " + avgList[count - 1] + " Player count: " + list[count - 1].Count)); embedCount++; playerCount = 1; o.ForEach(x => { var player = playerService.GetSpecificPlayer(x.PlayerId); if (playerCount % 25 == 0) { embedList.Add(new EmbedBuilder()); embedCount++; } embedList[embedCount].AddField(player.IngameName, player.PClass + " - " + Helpers.GetRoleFromList(player.Roles)); playerCount++; }); count++; }); embedList.ForEach(async o => await channel.SendMessageAsync("", false, o.Build())); } catch (Exception e) { await Context.Channel.SendMessageAsync(e.Message); var lm = new LogMessageService(); await lm.CreateLogEntry(e.Message, e.StackTrace); } }
public async Task RegisterPlayer([Remainder] string input) { var channel = await Context.User.GetOrCreateDMChannelAsync(); try { var player = await service.RegisterPlayer(input, Context.Message.Author.ToString(), Context.Message.Author.Id.ToString(), Context.Guild.Id.ToString()); await channel.SendMessageAsync($"Created {player.IngameName} with {player.Ilvl} ilvl, Cloak Level {player.CloakLevel} & mythic + score of {player.MythicScore} with the role {Helpers.GetRoleFromList(player.Roles)} - Class {player.PClass.ToString().Replace('_', ' ')} for Discord User {player.DiscordName}"); } catch (Exception EE) { await channel.SendMessageAsync(EE.Message); var lm = new LogMessageService(); await lm.CreateLogEntry(EE.Message, EE.StackTrace); } }
public async Task CreateRaid(int id) { try { var raid = service.DeleteRaid(id, Context.Guild.Id.ToString()); var embed = Helpers.GetEmbed(raid.RaidTitle, "ID:", raid.Id.ToString()).AddField("Date: ", raid.RaidDay.ToString("dd-MM HH:mm")); await Context.Channel.SendMessageAsync("", false, embed.Build()); await Context.Channel.SendMessageAsync("Raid set inactive"); } catch (Exception e) { await Context.Channel.SendMessageAsync(e.Message + "Use format: !deleteraid RaidId"); var lm = new LogMessageService(); await lm.CreateLogEntry(e.Message, e.StackTrace); } }
public async Task GetAllInactiveRaids() { try { var raidList = service.GetAllInactive(Context.Guild.Id.ToString()); raidList.ForEach(async o => { var embed = Helpers.GetEmbed(o.RaidTitle, "ID:", o.Id.ToString()).AddField("Date: ", o.RaidDay.ToString("dd-MM HH:mm")).AddField("Sign Ups: ", service.GetRaidSignupCount(o.Id).ToString()); await Context.Channel.SendMessageAsync("", false, embed.Build()); }); } catch (Exception e) { await Context.Channel.SendMessageAsync(e.Message); var lm = new LogMessageService(); await lm.CreateLogEntry(e.Message, e.StackTrace); } }
public async Task UpdatePlayerGuildAndIds() { var guildid = Context.Guild.Id; var userList = Context.Guild.Users; try { await service.UpdatePlayerGuildAndIds(userList); await Context.Channel.SendMessageAsync("Done"); } catch (Exception e) { await Context.Channel.SendMessageAsync(e.Message); var lm = new LogMessageService(); await lm.CreateLogEntry(e.Message, e.StackTrace); } }
public async Task SignUp([Remainder] string input) { try { var signup = service.SignUp(input, Context.Message.Author.ToString(), Context.Guild.Id.ToString()); var emb = Helpers.GetEmbed("Signup registred", raidService.GetSpecificRaid(signup.RaidId, Context.Guild.Id.ToString()).RaidTitle, playerService.GetSpecificPlayer(signup.PlayerId).IngameName); var msg = (RestUserMessage)await Context.Channel.GetMessageAsync(Context.Message.Id); await Helpers.ReactToMessage(msg, DefinedEmojis.Stars); await Context.Channel.SendMessageAsync("", false, emb.Build()); } catch (Exception e) { await Context.Channel.SendMessageAsync(e.Message); var lm = new LogMessageService(); await lm.CreateLogEntry(e.Message, e.StackTrace); } }
public async Task GetMyCharacters() { try { var liste = service.GetMyCharacters(Context.Message.Author.Id.ToString(), Context.Guild.Id.ToString()); var emb = new EmbedBuilder().WithTitle(liste[0].DiscordName + " Characters "); liste.ForEach(o => { var s1 = " - This is your main - "; var s2 = ""; emb.AddField(o.IngameName + " - " + o.Ilvl.ToString(), "Id: " + o.Id + (o.Main?s1:s2) + " " + Helpers.GetRoleFromList(o.Roles) + " - Cloak level:" + o.CloakLevel + " - M+ Score:" + o.MythicScore); }); await Context.Channel.SendMessageAsync("", false, emb.Build()); } catch (Exception e) { await Context.Channel.SendMessageAsync(e.Message); var lm = new LogMessageService(); await lm.CreateLogEntry(e.Message, e.StackTrace); } }
public async Task UnSubscribeRaidChannel() { var user = Context.Message.Author.ToString(); if (user != "Nillertron#5220") { return; } try { var ch = Context.Channel; await service.UnSubscribeChannel(ch.Id); await Context.Channel.SendMessageAsync("Done"); } catch (Exception e) { await Context.Channel.SendMessageAsync(e.Message); var lm = new LogMessageService(); await lm.CreateLogEntry(e.Message, e.StackTrace); } }
public async Task GetKeys() { try { var channel = await Context.User.GetOrCreateDMChannelAsync(); var KeyList = ks.GetAllKeys(); var eb = new EmbedBuilder().WithTitle("Keys:"); KeyList.ForEach(o => { eb.AddField(o.UserName, o.Key + " " + o.KeyLevel).WithCurrentTimestamp(); }); await channel.SendMessageAsync("", false, eb.Build()); } catch (Exception e) { await Context.Channel.SendMessageAsync(e.Message); var lm = new LogMessageService(); await lm.CreateLogEntry(e.Message, e.StackTrace); } }
public async Task SplitFromThreadGroups(List <List <SignUp> > list, string RaidOwnerDiscordId, List <int> avgList) { try { var channel = await Program.Client.GetUser(Convert.ToUInt64(RaidOwnerDiscordId)).GetOrCreateDMChannelAsync(); var embedList = new List <EmbedBuilder>(); int count = 1; int embedCount = -1; int playerCount = 1; var RaidLeaderDic = new Dictionary <int, Player>(); list.ForEach(o => { embedList.Add(new EmbedBuilder().WithTitle("Raid group " + count + " Avg ilvl: " + avgList[count - 1] + " Player count: " + list[count - 1].Count)); embedCount++; playerCount = 1; o.ForEach(x => { var player = playerService.GetSpecificPlayer(x.PlayerId); if (player.Roles.Contains(Role.RaidLeader)) { RaidLeaderDic.Add(count, player); } if (playerCount % 25 == 0) { embedList.Add(new EmbedBuilder()); embedCount++; } embedList[embedCount].AddField(player.IngameName, player.PClass + " - " + Helpers.GetRoleFromList(player.Roles)); playerCount++; }); count++; }); int lastKey = 0; var RLString = ""; foreach (var player in RaidLeaderDic) { if (player.Key == lastKey) { continue; } else { var ch = await Program.Client.GetUser(Convert.ToUInt64(player.Value.UserId)).GetOrCreateDMChannelAsync(); await ch.SendMessageAsync("Beep boop, you are assigned raid leader for group " + player.Key + " here is a list of players for you to invite"); await ch.SendMessageAsync("", false, embedList[player.Key - 1].Build()); lastKey = player.Key; RLString += "Group: " + player.Key + " - " + player.Value.IngameName + "\n"; } } await channel.SendMessageAsync("Your raid leaders today are:\n" + RLString); embedList.ForEach(async o => await channel.SendMessageAsync("", false, o.Build())); } catch (Exception e) { await Context.Channel.SendMessageAsync(e.Message); var lm = new LogMessageService(); await lm.CreateLogEntry(e.Message, e.StackTrace); } }