Exemple #1
0
 public static bool TryParse(string value, out RaidTime raidTime)
 {
     try
     {
         raidTime = Parse(value);
         return(true);
     }
     catch
     {
         raidTime = default;
         return(false);
     }
 }
Exemple #2
0
        public async Task AddRaidAsync([OverrideTypeParser(typeof(RaidLocationParser))][Description("Raid dungeon: MC|Ony|BWL|ZG|AQ20/40|Naxx")] RaidLocationId raidLocation, [Description("Raid time: MM/DD HH AM/PM format!")][Remainder] RaidTime raidTime)
        {
            ulong channelId = DbContext.Guild.RaidSignupChannelId ?? Context.Channel.Id;

            var signupChannel = Context.Guild.GetTextChannel(channelId);

            var signupMessage = await signupChannel.SendMessageAsync($"@everyone Signups for {raidLocation.Humanize().Transform(To.TitleCase)} at {raidTime} have started. If you have your character registered with the bot, click the reaction with your class icon to sign up!");

            await signupMessage.PinAsync();

            await AddRaidEmojisAsync(signupMessage);

            var raid = new Raid
            {
                Id             = signupMessage.Id,
                RaidLocationId = raidLocation,
                RaidTime       = raidTime
            };

            await DbContext.AddRaidAsync(raid);

            if (signupChannel.Id != Context.Channel.Id)
            {
                await ReplyAsync($"Raid signups started!");
            }
        }