Beispiel #1
0
        private static Task Bot_ShardReady(
            DiscordSocketClient arg
            )
        {
            if (!ShardsReady.Contains(arg.ShardId))
            {
                arg.MessageDeleted      += Shard_MessageDeleted;
                arg.MessagesBulkDeleted += Shard_MessagesBulkDeleted;
                arg.JoinedGuild         += Bot_JoinedGuild;
                arg.RoleDeleted         += Bot_RoleDeleted;
                arg.GuildMemberUpdated  += Bot_GuildMemberUpdated;
                arg.LeftGuild           += Bot_LeftGuild;
                arg.UserJoined          += Bot_UserJoined;
                arg.UserLeft            += Bot_UserLeft;
                arg.ReactionAdded       += Bot_ReactionAdded;
                arg.ReactionRemoved     += Bot_ReactionRemoved;
                arg.ReactionsCleared    += Bot_ReactionsCleared;
                arg.Log          += Bot_Log;
                arg.UserUpdated  += Bot_UserUpdated;
                arg.GuildUpdated += Bot_GuildUpdated;
                ShardsReady.Add(arg.ShardId);
            }

            HttpWebClient.SetUserAgent(arg.CurrentUser);

            Task.Run(async() =>
            {
                Thread.CurrentThread.IsBackground = true;
                await UpdateStatusAsync(arg).ConfigureAwait(false);
            });

            Log.Info($"Shard #{arg.ShardId}", "Shard Ready");

            return(Task.CompletedTask);
        }