示例#1
0
 public static async Task Discord_GuildMemberRemoved(DiscordClient client, GuildMemberRemoveEventArgs e)
 {
     new Thread(async() =>
     {
         var member = SpreadsheetTools.CheckUserAgainstSpreadsheet(e.Member.Id.ToString());
         if (member != null)
         {
             var clan         = BungieTools.GetClanFromTag(member.ClanTag);
             var discordEmbed = Core.Discord.CreateFancyMessage(clan.details.DiscordColour, clan.details.Name + " Member left Discord server!", "User was found on spreadsheet.", new List <Field>(2)
             {
                 new Field("Username", e.Member.Username + '#' + e.Member.Discriminator), new Field("ID", e.Member.Id.ToString())
             });
             Log.Information("Detected " + clan.details.Name + " member leaving discord");
             List <DiscordMessage> messages = new List <DiscordMessage>();
             foreach (var channel in Core.Discord.alertsChannels)
             {
                 messages.Add(await Core.Discord.SendFancyMessage(channel, discordEmbed));
             }
         }
     }).Start();
 }
示例#2
0
        static async Task <Clan> GetClanFromTagOrNameAsync(CommandContext ctx, string clanNameOrTag)
        {
            var clanByTag  = BungieTools.GetClanFromTag(clanNameOrTag);
            var clanByName = BungieTools.GetClanFromName(clanNameOrTag);

            if (clanByTag != null)
            {
                return(clanByTag);
            }
            else if (clanByName != null)
            {
                return(clanByName);
            }
            else
            {
                var discordEmbed = Core.Discord.CreateFancyMessage(DiscordColor.IndianRed, "Sorry!", "The clan you provided is invalid!");
                await ctx.RespondAsync(discordEmbed);

                return(null);
            }
        }