-
Notifications
You must be signed in to change notification settings - Fork 0
/
Program.cs
91 lines (78 loc) · 2.62 KB
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
using System;
using System.Collections.Generic;
using System.Reflection;
using System.Threading.Tasks;
using Bishop.Commands.CardGame;
using Bishop.Commands.Dump;
using Bishop.Commands.Horoscope;
using Bishop.Commands.Record.Controller;
using Bishop.Commands.Record.Controller.Aliases;
using Bishop.Commands.Weather.Controller;
using Bishop.Config;
using DSharpPlus;
using DSharpPlus.Entities;
using log4net;
using log4net.Config;
using Plotly.NET.ImageExport;
namespace Bishop;
internal static class Program
{
private static readonly ILog Log = LogManager
.GetLogger(MethodBase.GetCurrentMethod()?
.DeclaringType);
private static readonly string? ChromiumPath = Environment
.GetEnvironmentVariable("CHROMIUM_PATH");
private static readonly string? BotStatus = Environment
.GetEnvironmentVariable("BOT_STATUS");
private static DiscordClient _discord = null!;
private static DiscordClientGenerator _generator = null!;
/// <summary>
/// Array containing all the classes that must be registered as commands through
/// the <see cref="DiscordClientGenerator" />.BulkRegister method.
/// </summary>
private static readonly Type[] CommandClasses = new List<Type>
{
typeof(Randomizer),
typeof(Stalk),
typeof(Aled),
typeof(Tomato),
typeof(Piggies),
typeof(Referendum),
typeof(HoroscopeController),
typeof(Quote),
typeof(Deleter),
typeof(CardGameService),
typeof(WeatherController),
typeof(RacletteCounterController),
typeof(BdmCounterController),
typeof(BeaufCounterController),
typeof(RassCounterController),
typeof(SauceCounterController),
typeof(MalfoyCounterController),
typeof(SelCounterController),
typeof(WindCounterController),
typeof(RecordController),
}.ToArray();
[STAThread]
private static void Main()
{
XmlConfigurator.Configure();
if (ChromiumPath != null)
{
PuppeteerSharpRendererOptions.localBrowserExecutablePath = ChromiumPath;
PuppeteerSharpRendererOptions.launchOptions.Args = new[] {"--no-sandbox"};
}
_generator = new DiscordClientGenerator();
_generator.RegisterBulk(CommandClasses);
_discord = _generator.Client;
Log.Info("Awaiting commands");
MainAsync()
.GetAwaiter()
.GetResult();
}
private static async Task MainAsync()
{
await _discord.ConnectAsync(new DiscordActivity(BotStatus, ActivityType.Competing));
await Task.Delay(-1);
}
}