示例#1
0
        private async Task SendIndexWarningMessage(JsonClasses.SovStructureData data, SovTrackerGroup group)
        {
            var system = await APIHelper.ESIAPI.GetSystemData(Reason, data.solar_system_id);

            var alliance = await APIHelper.ESIAPI.GetAllianceData(Reason, data.alliance_id);

            var msg   = LM.Get("sovLowIndexMessage", data.vulnerability_occupancy_level);
            var embed = new EmbedBuilder()
                        .WithThumbnailUrl(Settings.Resources.ImgLowFWStand)
                        .AddField(LM.Get("sovSystem"), system?.name ?? LM.Get("Unknown"), true)
                        .AddField(LM.Get("sovHolder"), alliance?.name ?? LM.Get("Unknown"), true)
                        .AddField(LM.Get("sovMessage"), msg);
            var ch      = APIHelper.DiscordAPI.GetChannel(group.DiscordChannelId);
            var mention = string.Join(' ', group.DiscordMentions);

            if (string.IsNullOrEmpty(mention))
            {
                mention = " ";
            }
            await APIHelper.DiscordAPI.SendMessageAsync(ch, $"{mention}", embed.Build()).ConfigureAwait(false);
        }
示例#2
0
        private async Task SendHolderChangedMessage(JsonClasses.SovStructureData data, JsonClasses.SovStructureData old, SovTrackerGroup @group, bool isTcu)
        {
            var system = await APIHelper.ESIAPI.GetSystemData(Reason, data?.solar_system_id ?? old.solar_system_id);

            var owner = data != null ? await APIHelper.ESIAPI.GetAllianceData(Reason, data.alliance_id) : null;

            var oldOwner = old != null ? await APIHelper.ESIAPI.GetAllianceData(Reason, old.alliance_id) : null;

            string msg;

            if (owner == null)
            {
                msg = LM.Get("sovLostStructure", isTcu? "TCU": "IHUB");
            }
            else
            {
                var oldHolder = old == null?LM.Get("sovSystemUncontested") : LM.Get("sovSystemWasOwnedBy", oldOwner.name, oldOwner.ticker);

                var timers = data == null
                    ? null
                    : LM.Get("sovNextVulnerability", data.vulnerable_start_time.ToString(Settings.Config.ShortTimeFormat), data.vulnerable_end_time.ToString(Settings.Config.ShortTimeFormat));
                msg = $"{LM.Get("sovNewHolder", owner.name, owner.ticker)} {oldHolder}{timers}";
            }
            var embed = new EmbedBuilder()
                        .WithThumbnailUrl(Settings.Resources.ImgLowFWStand)
                        .AddField(LM.Get("sovSystem"), system?.name ?? LM.Get("Unknown"), true)
                        .AddField(LM.Get("sovMessage"), msg);
            var ch      = APIHelper.DiscordAPI.GetChannel(group.DiscordChannelId);
            var mention = string.Join(' ', group.DiscordMentions);

            if (string.IsNullOrEmpty(mention))
            {
                mention = " ";
            }
            await APIHelper.DiscordAPI.SendMessageAsync(ch, $"{mention}", embed.Build()).ConfigureAwait(false);
        }