add game activity
This commit is contained in:
parent
08c6373012
commit
219cf0da88
@ -77,7 +77,24 @@ public class Program
|
|||||||
await _voicevoxAPI.Setup("http://localhost:50021");
|
await _voicevoxAPI.Setup("http://localhost:50021");
|
||||||
await _client.LoginAsync(TokenType.Bot, configuration.AppSettings.DiscordSettings.Token);
|
await _client.LoginAsync(TokenType.Bot, configuration.AppSettings.DiscordSettings.Token);
|
||||||
await _client.StartAsync();
|
await _client.StartAsync();
|
||||||
|
await _client.SetActivityAsync(new Game("!join"));
|
||||||
|
|
||||||
|
// _client.Disconnected += async (exception) =>
|
||||||
|
// {
|
||||||
|
// await _client.StopAsync();
|
||||||
|
// await _client.StartAsync();
|
||||||
|
// };
|
||||||
|
|
||||||
|
_client.UserVoiceStateUpdated += async (user, before, after) =>
|
||||||
|
{
|
||||||
|
if (user.Id != _client.CurrentUser.Id) return;
|
||||||
|
if (before.VoiceChannel.Id == after.VoiceChannel.Id) return;
|
||||||
|
|
||||||
|
if (after.VoiceChannel is not null)
|
||||||
|
{
|
||||||
|
_services.GetRequiredService<AudioManager>().JoinChannel(after.VoiceChannel);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
await Task.Delay(-1); //keep the program running
|
await Task.Delay(-1); //keep the program running
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user