forked from tuxinal/impostorCord
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cs
63 lines (51 loc) · 1.99 KB
/
main.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
using Impostor.Api.Events.Managers;
using Impostor.Api.Plugins;
using System.Text.Json;
using System.Text.Json.Serialization;
using System.IO;
using Microsoft.Extensions.Logging;
using Impostor.Plugins.ImpostorCord.Handlers;
using Impostor.Plugins.ImpostorCord.Discord;
namespace Impostor.Plugins.ImpostorCord
{
[ImpostorPlugin(
package: "com.Tuxinal.ImpostorCord",
name: "ImpostorCord",
author: "Tuxinal",
version: "0.1.7")]
public class ImpostorCord : PluginBase
{
private readonly ILogger<ImpostorCord> _logger;
private Bot _bot;
private readonly Config config;
public ImpostorCord(ILogger<ImpostorCord> logger, IEventManager eventManager)
{
_logger = logger;
string configFile = File.ReadAllText("./config.impostorCord.json");
config = JsonSerializer.Deserialize<Config>(configFile);
_bot = new Bot(config);
eventManager.RegisterListener(new GameEventListener(logger, _bot));
}
}
public class Config
{
[JsonPropertyName("token")]
public string Token { get; set; }
[JsonPropertyName("prefix")]
public string Prefix { get; set; }
[JsonPropertyName("botProxyEnabled")]
public bool BotProxyEnabled { get; set; }
[JsonPropertyName("botProxyAddress")]
public string BotProxyAddress { get; set; }
[JsonPropertyName("botProxyUsername")]
public string BotProxyUsername { get; set; }
[JsonPropertyName("botProxyPassword")]
public string BotProxyPassword { get; set; }
[JsonPropertyName("extraSecondsOfTalkAfterMeeting")]
public uint ExtraSecondsOfTalkAfterMeeting { get; set; }
[JsonPropertyName("deadСanTalkDuringTasks")]
public bool DeadСanTalkDuringTasks { get; set; }
[JsonPropertyName("removeCommands")]
public bool removeCommands { get; set; }
}
}