-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathReadyLoop.cs
More file actions
37 lines (32 loc) · 1.24 KB
/
ReadyLoop.cs
File metadata and controls
37 lines (32 loc) · 1.24 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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Mint_Chan
{
internal class ReadyLoop
{
internal static Task StartLoop()
{
GlobalConfig.Server = GlobalConfig.Client.GetGuild(GlobalConfig.guildID);
if (GlobalConfig.Server != null) // Checks if bots are in the server
{
Console.WriteLine("| Server Detected: " + GlobalConfig.Server.Name);
}
else
{
Console.WriteLine($"| A server has not been defined.");
}
while (GlobalConfig.Server == null || GlobalConfig.Server.Name == null || GlobalConfig.Server.Name.Length < 1)
{
Console.WriteLine($"| Waiting for connection to be established by Discord...");
Task.Delay(1200);
}
Program.botUserId = GlobalConfig.Client.CurrentUser.Id; // Bots user ID is detected and filled in automatically.
Program.botName = GlobalConfig.Server.GetUser(Program.botUserId).Nickname ??
GlobalConfig.Server.GetUser(Program.botUserId).Username;
return Task.CompletedTask;
}
}
}