public DiscordMapper(DiscordMapperOptions options)
 {
     _options = options;
     // Create a host config with no interactivity
     // (buttons in images would be deceiving)
     _adaptiveHostConfig = new AdaptiveHostConfig()
     {
         SupportsInteractivity = false
     };
 }
示例#2
0
        public DiscordAdapter(DiscordAdapterOptions discordAdapterOptions, IBot bot, DiscordMapper discordMapper = null, DiscordMapperOptions discordMapperOptions = null)
        {
            _options                 = discordAdapterOptions;
            _client                  = new DiscordSocketClient();
            _client.Log             += LogAsync;
            _client.Ready           += ReadyAsync;
            _client.MessageReceived += MessageReceivedAsync;
            _mapper                  = discordMapper ?? new DiscordMapper(discordMapperOptions ?? new DiscordMapperOptions());
            _bot = bot;

            _client.LoginAsync(TokenType.Bot, _options.Token).GetAwaiter().GetResult();
            _client.StartAsync().GetAwaiter().GetResult();
        }