{"action":"opened","issue":{"url":"https://api.github.com/repos/RogueException/Discord.Net/issues/1058","repository_url":"https://api.github.com/repos/RogueException/Discord.Net","labels_url":"https://api.github.com/repos/RogueException/Discord.Net/issues/1058/labels{/name}","comments_url":"https://api.github.com/repos/RogueException/Discord.Net/issues/1058/comments","events_url":"https://api.github.com/repos/RogueException/Discord.Net/issues/1058/events","html_url":"https://github.com/RogueException/Discord.Net/issues/1058","id":322499663,"number":1058,"title":"Error","user":{"login":"burgerlX","id":39022450,"avatar_url":"https://avatars2.githubusercontent.com/u/39022450?v=4","gravatar_id":"","url":"https://api.github.com/users/burgerlX","html_url":"https://github.com/burgerlX","followers_url":"https://api.github.com/users/burgerlX/followers","following_url":"https://api.github.com/users/burgerlX/following{/other_user}","gists_url":"https://api.github.com/users/burgerlX/gists{/gist_id}","starred_url":"https://api.github.com/users/burgerlX/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/burgerlX/subscriptions","organizations_url":"https://api.github.com/users/burgerlX/orgs","repos_url":"https://api.github.com/users/burgerlX/repos","events_url":"https://api.github.com/users/burgerlX/events{/privacy}","received_events_url":"https://api.github.com/users/burgerlX/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-05-12T10:13:30Z","updated_at":"2018-05-12T10:13:30Z","closed_at":null,"author_association":"NONE","body":"i have this code\r\n`using System;\r\nusing System.Threading.Tasks;\r\n\r\nusing Discord.WebSocket;\r\nusing Discord.Commands;\r\nusing Microsoft.Extensions.DependencyInjection;\r\nusing System.Reflection;\r\nusing Discord;\r\n\r\nnamespace Discord_bots\r\n{\r\n    class Program\r\n    {\r\n        static void Main(string[] args)\r\n        {\r\n            Program prg = new Program();\r\n            prg.RunBotAsynch()\r\n                .GetAwaiter()\r\n                .GetResult();\r\n        }\r\n\r\n        private DiscordSocketClient _client;\r\n        private CommandService _commands;\r\n        private IServiceProvider _services;\r\n\r\n        #region tasks\r\n\r\n        public async Task RunBotAsynch()\r\n        {\r\n            Console.WriteLine(\"starting!\");\r\n\r\n            _client = new DiscordSocketClient();\r\n            _commands = new CommandService();\r\n\r\n            _services = new ServiceCollection()\r\n                .AddSingleton(_client)\r\n                .AddSingleton(_commands)\r\n                .BuildServiceProvider();\r\n\r\n\r\n            string botToken = \"NDQyMzE5OTg1NjI5NDYyNTI4.DdhO7Q.51iE983HyDJeU7jFJ5AQKpIVOHI\";\r\n\r\n            //event substriction\r\n            _client.Log += Log;\r\n\r\n            await RegisterCommandsAsynch();\r\n\r\n            await _client.LoginAsync(Discord.TokenType.Bot, botToken);\r\n\r\n            await _client.StartAsync();\r\n\r\n            await Task.Delay(-1);\r\n        }\r\n\r\n        private Task Log(LogMessage arg)\r\n        {\r\n            Console.WriteLine(arg);\r\n\r\n            return Task.CompletedTask;\r\n        }\r\n\r\n        public async Task RegisterCommandsAsynch()\r\n        {\r\n            _client.MessageReceived += HandleCommandAsynch;\r\n\r\n            await _commands.AddModulesAsync(Assembly.GetEntryAssembly());\r\n        }\r\n\r\n        private async Task HandleCommandAsynch(SocketMessage arg)\r\n        {\r\n            var messige = arg as SocketUserMessage;\r\n\r\n            if (messige is null || messige.Author.IsBot)\r\n            {\r\n                return;\r\n            }\r\n\r\n            int argPos = 0;\r\n\r\n            if (messige.HasStringPrefix(\"!m\", ref argPos) || messige.HasMentionPrefix(_client.CurrentUser, ref argPos))\r\n            {\r\n                var context = new SocketCommandContext(_client, messige);\r\n\r\n                var resoult = await _commands.ExecuteAsync(context, argPos, _services);\r\n\r\n                if (!resoult.IsSuccess)\r\n                {\r\n                    Console.WriteLine(resoult.ErrorReason + \" and error is \" + resoult.Error);\r\n\r\n\r\n                }\r\n            }\r\n        }\r\n\r\n        #endregion\r\n    }\r\n}\r\n`\r\n\r\nand its saying at\r\n `            prg.RunBotAsynch()\r\n                .GetAwaiter()\r\n                .GetResult();\r\n` this : System.InvalidOperationException: Cannot add commands to the root node.\r\n\r\nanyone knows how to fix this?"}}
{"actor":{"display_login":"burgerlX"}}