Example #1
0
        private string GetAliasString(EpgpAlias alias)
        {
            var emoteName          = alias.Class.GetEmoteName();
            var fullyQualifiedName = _emoteService.GetFullyQualifiedName(Context.Guild.Id, emoteName);

            return($"{fullyQualifiedName} {alias.Name}");
        }
Example #2
0
        public async Task PostRaid(IMessageChannel channel, EpgpRaid raidObject)
        {
            if (!(channel is IGuildChannel guildChannel))
            {
                throw new ArgumentException("Raids can only be posted to server text channels");
            }

            var leader = await guildChannel.GetUserAsync(raidObject.RaidLeader);

            IMessageChannel leaderChannel;

            if (leader == null)
            {
                leaderChannel = channel;
            }
            else
            {
                leaderChannel = await leader.GetOrCreateDMChannelAsync();
            }
            var domainRaid = new Raid()
            {
                Id = Guid.NewGuid(), StartTime = raidObject.StartTime, EndTime = raidObject.StartTime + raidObject.Duration, Name = raidObject.Name
            };

            _dbContext.Raids.Add(domainRaid);
            _dbContext.SaveChanges();
            raidObject.RaidId = domainRaid.Id;
            var guildId = guildChannel.GuildId;
            var message = await channel.SendMessageAsync("", false, CreateEmbed(raidObject, guildChannel.GuildId), null);

            var raidData = new RaidData(message, raidObject, guildChannel.GuildId);

            raidData.LeaderChannel   = leaderChannel;
            _client.ReactionAdded   += ReactionAdded;
            _client.ReactionRemoved += ReactionRemoved;
            _aliasEventAlerter.ActiveAliasChanged += ActiveAliasChanged;
            await message.AddReactionAsync(Emote.Parse(_emoteService.GetFullyQualifiedName(guildId, EmbedConstants.CasterEmoteName)));

            await message.AddReactionAsync(Emote.Parse(_emoteService.GetFullyQualifiedName(guildId, EmbedConstants.MeleeEmoteName)));

            await message.AddReactionAsync(Emote.Parse(_emoteService.GetFullyQualifiedName(guildId, EmbedConstants.RangedEmoteName)));

            await message.AddReactionAsync(Emote.Parse(_emoteService.GetFullyQualifiedName(guildId, EmbedConstants.TankEmoteName)));

            await message.AddReactionAsync(Emote.Parse(_emoteService.GetFullyQualifiedName(guildId, EmbedConstants.HealerEmoteName)));

            await message.AddReactionAsync(new Emoji("❌"));

            using (var raidMonitor = await AddRaid(raidData))
            {
                await raidMonitor.Run();
            }
            await RemoveRaid(raidData);
        }