コード例 #1
0
        private async Task MainAsync(string[] args)
        {
            Utils.InitFemaleSpriteLookup();
            ReplaySaver.RemoveOldReplays();
            PBEDefaultDataProvider.InitEngine(string.Empty);

            _client = new DiscordSocketClient();

            _commands = new CommandService(new CommandServiceConfig {
                DefaultRunMode = RunMode.Async
            });
            await _commands.AddModulesAsync(Assembly.GetEntryAssembly(), null);

            _client.Log                += LogMessage;
            _client.MessageReceived    += CommandMessageReceived;
            _client.ReactionAdded      += OnReactionAdded;
            _client.ChannelDestroyed   += OnChannelDeleted;
            _client.LeftGuild          += OnLeftGuild;
            _client.UserLeft           += OnUserLeft;
            _client.Connected          += OnConnected;
            _client.Disconnected       += OnDisconnected;
            _client.GuildMemberUpdated += OnGuildMemberUpdated;

            await _client.LoginAsync(TokenType.Bot, args[0]); // Token is passed in as args[0]

            await _client.StartAsync();

            await Task.Delay(-1);
        }
コード例 #2
0
 public TestUtils()
 {
     PBEDefaultDataProvider.InitEngine(string.Empty);
 }