Exemple #1
0
        public override async Task RunAsync(LocalizationService lcs)
        {
            if (_image is null)
            {
                return;
            }

            CultureInfo culture = lcs.GetGuildCulture(this.gid);

            try {
                using Bitmap wof = RotateWheel(_image, this.index * -45);
                using var ms     = new MemoryStream();
                wof.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
                ms.Position = 0;
                await this.Channel.SendFileAsync("wof.png", ms, embed : new DiscordEmbedBuilder {
                    Description = lcs.GetString(this.gid, "fmt-casino-win", this.user.Mention, this.WonAmount.ToWords(culture), this.WonAmount, this.currency),
                    Color       = DiscordColor.DarkGreen
                });
            } catch (Exception e) {
                Log.Error("Failed to process wheel of fortune image!", e);
            }
        }