示例#1
0
 private void Log()
 {
     // If this was successful it's sorted
     if (AkiraSql.LogPunishment(this))
     {
         return;
     }
 }
示例#2
0
        public async Task MainAsync()
        {
            _client      = new DiscordSocketClient();
            _client.Log += Log;

            _commands = new CommandService();
            _services = new ServiceCollection()
                        .AddSingleton(_client)
                        .AddSingleton(_commands)
                        .BuildServiceProvider();

            await CommandAsync();

            await _client.LoginAsync(TokenType.Bot, AkiraSql.GetConfigurationValue("DiscordToken"));

            await _client.StartAsync();

            await Task.Delay(-1);
        }
示例#3
0
        public async Task HandleCommandAsync(SocketMessage msg)
        {
            SocketUserMessage    message = (SocketUserMessage)msg;
            SocketCommandContext context = new SocketCommandContext(_client, message);

            int argPos = 0;

            if (message.Author.IsBot)
            {
                return;
            }

            if (message.HasStringPrefix(AkiraSql.GetConfigurationValue("DiscordPrefix"), ref argPos))
            {
                var result = await _commands.ExecuteAsync(context, argPos, _services);

                if (!result.IsSuccess)
                {
                    Console.WriteLine(result.ErrorReason);
                }
            }
        }
示例#4
0
 public static void StartUp()
 {
     AkiraConfiguration.Initialize();
     AkiraSql.Initialize();
     AkiraThread.Initialize();
 }