-
Notifications
You must be signed in to change notification settings - Fork 0
/
Program.cs
64 lines (49 loc) · 1.89 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
using DSharpPlus;
using DSharpPlus.CommandsNext;
using DSharpPlus.Entities;
using DSharpPlus.Exceptions;
using DiscordRegisterManagementBot.Commands.Prefix;
using DiscordRegisterManagementBot.config;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using DiscordRegisterManagementBot.Events;
using DiscordRegisterManagementBot.Entities;
namespace DiscordRegisterManagementBot
{
public class Program
{
public static DiscordClient Client { get; set; }
public static CommandsNextExtension Commands { get; set; }
static async Task Main(string[] args)
{
var jsonReader = new JsonReader();
dynamic obj = await jsonReader.ReadJson<ReadToken>("config.json");
var discordConfig = new DiscordConfiguration()
{
Intents = DiscordIntents.All,
Token = obj.token,
TokenType = TokenType.Bot,
AutoReconnect = true
};
Client = new DiscordClient(discordConfig);
Client.Ready += Client_events.Client_Ready;
Client.ComponentInteractionCreated += Client_events.Client_ComponentInteractionCreated;
Client.GuildMemberAdded += Client_events.Client_GuildMemberAdded;
Client.ModalSubmitted += Client_events.Client_ModalSubmitted;
var commandsConfig = new CommandsNextConfiguration()
{
StringPrefixes = new string[] { obj.prefix },
EnableMentionPrefix = true,
EnableDms = true,
EnableDefaultHelp = false,
};
Commands = Client.UseCommandsNext(commandsConfig);
Commands.RegisterCommands<Register_Commands>();
await Client.ConnectAsync();
await Task.Delay(-1);
}
}
}