-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.vb
More file actions
56 lines (48 loc) · 1.86 KB
/
Program.vb
File metadata and controls
56 lines (48 loc) · 1.86 KB
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
Imports System
Imports System.IO
Imports System.Net
Imports System.Threading
Imports System.Timers
Imports Ceen
Imports Ceen.Httpd
Imports Ceen.Httpd.Logging
Imports Ceen.Mvc
Imports MongoDB.Driver
Module Program
Public mongo_client As MongoClient
Public db As MongoDatabase
Public ReadOnly DiscordAPI As String = "https://discord.com/api/v8/"
Sub Main(args As String())
If Config.LoadConfig() = False Then
Config.NewConfig()
Console.WriteLine("No config found... Press any key to close")
Console.Read()
End
End If
If Not Directory.Exists("data") Then
Directory.CreateDirectory("data")
End If
If Not Directory.Exists("data/guilds") Then
Directory.CreateDirectory("data/guilds")
End If
If Not Directory.Exists("data/tags") Then
Directory.CreateDirectory("data/tags")
End If
If Not Directory.Exists("data/langs") Then
Directory.CreateDirectory("data/langs")
End If
mongo_client = New MongoClient(Config.CurrentConfig.mongodb)
db = mongo_client.GetServer().GetDatabase("source_servers")
Lang.Load()
Bot.PrepareBot()
Bot.Start().GetAwaiter.GetResult()
Dim tcs = New CancellationTokenSource()
Dim ceen_config = New ServerConfig().AddLogger(New CLFStdOut()).
AddRoute(GetType(Web.API.V2.Webhooks.Interactions).Assembly.ToRoute(New ControllerRouterConfig(GetType(Web.API.V2.Webhooks.Interactions)))).
AddRoute(GetType(Web.Index).Assembly.ToRoute(New ControllerRouterConfig(GetType(Web.Index))))
Dim ceen_task = HttpServer.ListenAsync(New IPEndPoint(IPAddress.Any, Config.CurrentConfig.ApplicationPort), False, ceen_config, tcs.Token)
While True
Console.ReadLine()
End While
End Sub
End Module