Example #1
0
        public async Task MessageCount()
        {
            sql.Setup();
            string userMsgCount      = sql.GetSingleValue($"SELECT msgCount FROM users WHERE id = '{Context.Message.Author.Id}'");
            string guildMessageCount = sql.GetSingleValue("SELECT msgCount FROM stats WHERE id = 'gves'");

            await ReplyAsync("There are currently **" + (int.Parse(guildMessageCount) + 1) + "** messages in this discord!" + Environment.NewLine + Environment.NewLine + "<@" + Context.Message.Author.Id.ToString() + "> has sent **" + userMsgCount + "** messages in this discord!");
        }
Example #2
0
        async Task RunBotAsync()
        {
            _sql      = new sqlConnector();
            _client   = new DiscordSocketClient();
            _commands = new CommandService();
            _services = new ServiceCollection()
                        .AddSingleton(_client)
                        .AddSingleton(_commands)
                        .BuildServiceProvider();

            _sql.Setup();

            var botToken = ConfigurationManager.AppSettings["token"];

            _client.Log += Log;

            await RegisterCommandsAsync();

            await _client.LoginAsync(TokenType.Bot, botToken);

            await _client.StartAsync();

            await Task.Delay(-1);
        }