-
Notifications
You must be signed in to change notification settings - Fork 0
/
Program.cs
48 lines (40 loc) · 1.61 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
using Discord;
using Discord.Commands;
using Discord.WebSocket;
using Discord.Interactions;
using Lavalink4NET.Extensions;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.DependencyInjection;
namespace Template {
public class Program
{
private static async Task Main(string[] args){
using IHost host = Host.CreateDefaultBuilder(args)
.ConfigureServices(services =>
{
services.AddSingleton(new DiscordSocketClient(new DiscordSocketConfig()
{
GatewayIntents = GatewayIntents.Guilds
| GatewayIntents.GuildMembers
| GatewayIntents.GuildMessages
| GatewayIntents.MessageContent
}));
services.AddHostedService<DiscordStartupService>();
//Commands
services.AddHostedService<TextBasedCommandHandlingService>();
services.AddSingleton<CommandService>();
//MusicPart
services.AddLavalink();
services.ConfigureLavalink(config =>
{
config.BaseAddress = new Uri("http://127.0.0.1:2333/");
config.WebSocketUri = new Uri("ws://127.0.0.1:2333/v4/websocket");
config.Passphrase = "urpassword";
});
services.AddHostedService<BotAudioService>();
})
.Build();
await host.RunAsync();
}
}
}