Imports Discord
Imports Discord.WebSocket
Imports Discord.Net.Providers.WS4Net
Imports System.Windows.Forms
Imports System.Drawing
Imports System.Runtime.InteropServices
Imports System.Threading
Imports Discord.Commands
Public Module Main
Private config As MasterConfig
Private Client As DiscordSocketClient
Private d_events As DiscordEvents
Private commandHandle As CommandHandler
Sub Main(args As String())
RunBotASync.GetAwaiter.GetResult()
End Sub
Private Async Function RunBotASync() As Task
Console.WriteLine("Now Loading Bot...")
config = Await MasterConfig.LoadAsync
Dim ClientConfig As New DiscordSocketConfig With {
.DefaultRetryMode = Discord.RetryMode.AlwaysRetry,
.LogLevel = LogSeverity.Info,
.WebSocketProvider = WS4NetProvider.Instance
}
Client = New DiscordSocketClient(ClientConfig)
d_events = New DiscordEvents(Client)
commandHandle = New CommandHandler(config, Client)
Await Client.LoginAsync(TokenType.Bot, config.token)
Await Client.StartAsync()
Await Task.Delay(Timeout.Infinite)
Await Client.SetGameAsync("Giving Damage While Taking Damage | -help", ActivityType.Playing, ActivityProperties.None).ConfigureAwait(False)
End Function
End Module
So this is my whole function to get my bot running and connected. The issue I'm having is that I'm not entirely sure where to place Await Client.SetGameAsync()
in the code. I've tried it above Await Client.StartAsync()
and I don't get any errors but the status doesn't show.
With the help of the Discord API Server, I figured it out. create a function with your custom status.
and right below
StartAsync()
doAddHandler Client.Ready, AddressOf Ready
and now you have your custom status.