-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProgram.cs
63 lines (52 loc) · 1.91 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
using DiscordBotTemplateNet7.Commands;
using DiscordBotTemplateNet7.Config;
using DSharpPlus;
using DSharpPlus.CommandsNext;
using DSharpPlus.EventArgs;
using DSharpPlus.Interactivity;
using DSharpPlus.Interactivity.Extensions;
namespace DiscordBotTemplateNet7
{
public sealed class Program
{
public static DiscordClient Client { get; private set; }
public static CommandsNextExtension Commands { get; private set; }
static async Task Main(string[] args)
{
var botConfig = new BotConfig();
await botConfig.ReadJSON();
var config = new DiscordConfiguration()
{
Intents = DiscordIntents.All,
Token = botConfig.Token,
TokenType = TokenType.Bot,
AutoReconnect = true
};
Client = new DiscordClient(config);
Client.UseInteractivity(new InteractivityConfiguration
{
Timeout = TimeSpan.FromMinutes(3)
});
Client.Ready += OnClientReady;
var commandsConfig = new CommandsNextConfiguration
{
StringPrefixes = new string[] { botConfig.Prefix },
EnableMentionPrefix = true,
EnableDms = true,
EnableDefaultHelp = false
};
Commands = Client.UseCommandsNext(commandsConfig);
Commands.RegisterCommands<Basic>();
Console.WriteLine("============================== \n" +
"NET 7.0 C# Discord Bot \n" +
"Made by samjesus8 \n" +
"==============================");
await Client.ConnectAsync();
await Task.Delay(-1);
}
private static Task OnClientReady(DiscordClient sender, ReadyEventArgs args)
{
return Task.CompletedTask;
}
}
}