/// <summary> /// When Bot is up, set up event handlers for guilds and voice channel updates. /// </summary> /// <param name="e"></param> /// <returns></returns> private async Task OnClientReadyAsync(DSharpPlus.EventArgs.ReadyEventArgs e) { BotId = Client.CurrentUser.Id; BotUser = Client.CurrentUser; await ClientReadyAsync(e); }
private Task Client_Ready(DiscordClient sender, DSharpPlus.EventArgs.ReadyEventArgs e) { sender.Logger.LogInformation($"Shard {sender.ShardId} Ready"); _ = Task.Run(async() => await sender.UpdateStatusAsync(new($"pb!help | {Version}"), UserStatus.Online)); return(Task.CompletedTask); }
public Task Ready(DSharpPlus.EventArgs.ReadyEventArgs e) { client.UpdateStatusAsync(new DSharpPlus.Entities.Game("ForGamer Benimle")); Console.ForegroundColor = ConsoleColor.Green; Konsol.WriteLine("--- Bot Hazır ---"); return(Task.Delay(0)); }
/// <summary> /// When Bot is up, set up event handlers for guilds and voice channel updates. /// </summary> /// <param name="e"></param> /// <returns></returns> override public async Task ClientReadyAsync(DSharpPlus.EventArgs.ReadyEventArgs e) { if (!File.Exists("botState.json")) { State = new BotStateConfig(); } else { //Deserealize bot last state using (var sr = new StreamReader("botState.json")) { State = JsonConvert.DeserializeObject <BotStateConfig>( await sr.ReadToEndAsync() ); if (State == null) { State = new BotStateConfig(); } } } //Should I discard instead of await this one. If it get's stuck it won't function anywhere past this method #pragma warning disable CS1998 e.Client.GuildAvailable += async(e) => _ = InitGuildAsync(e.Guild).ConfigureAwait(false); #pragma warning restore CS1998 //foreach (var g in e.Client.Guilds) { // if (g.Value.Name == null) // e.Client.GuildAvailable += (z) => InitGuildAsync(z.Guild); // else // _ = InitGuildAsync(g.Value); //} Client.VoiceStateUpdated += Client_VoiceStateUpdated; //Client.MessageReactionAdded += Client_MessageReactionAdded; //Client.MessageReactionRemoved += Client_MessageReactionRemoved; ; //???? //State.Guilds.ForEach(g => { // DiscordGuild guild; // Client.Guilds.TryGetValue(g.GuildId, out guild); // g.Guild = guild; //}); }
private Task Client_Ready(DSharpPlus.EventArgs.ReadyEventArgs e) { Console.WriteLine("Connected!!"); ReadyTime = DateTime.Now; commandManager = new CommandsManager(client); /// Hold off on initing commands and modules until AFTER we've setup with an owner. if (!SetupMode) { commandManager.ReadPermissionsFile(); if (CommandsManager.UserRoles.Count == 0 && !String.IsNullOrEmpty(config.OwnerID)) { CommandsManager.UserRoles.Add(config.OwnerID, PermissionType.Owner); } InitCommands(); LoadModules(); } return(Task.Delay(0)); }
private Task OnReady(DSharpPlus.EventArgs.ReadyEventArgs e) { e.Client.DebugLogger.LogMessage(LogLevel.Info, "Silk!", "Ready to process events.", DateTime.Now); return(Task.CompletedTask); }