示例#1
0
        public DiscordBotManager(DiscordApiClient apiClient, DiscordGatewayClient gatewayClient, DatabaseContext databaseContext,
                                 CommandHandler commandHandler, ILogger logger, IOptions <BotSettingsConfiguration> options)
        {
            ApiClient     = apiClient;
            GatewayClient = gatewayClient;

            DbContext      = databaseContext;
            BotUser        = new DiscordBotUser();
            CommandHandler = commandHandler;
            Logger         = logger;
            OwnerID        = options.Value.AdminID;

            GatewayClient.AddMessageCallback(HandleGatewayEvent);
        }
示例#2
0
    public DiscordVoiceClient(string userId, DiscordGatewayClient gateway)
    {
        this.gateway = gateway;
        this.userId  = userId;

        //Voice initialization
        Messenger.AddListener <VoiceServerUpdate>(DiscordEvent.Voice.ServerUpdate, OnServerUpdate);
        Messenger.AddListener <VoiceStateUpdateResponse>(DiscordEvent.Voice.StatusUpdate, OnStatusUpdate);
        Messenger.AddListener <HelloEventData>(DiscordEvent.Voice.Hello, OnHello);
        Messenger.AddListener <VoiceReadyResponse>(DiscordEvent.Voice.Ready, OnReady);
        Messenger.AddListener <SessionDesciptionResponse>(DiscordEvent.Voice.SessionDesciption, OnSessionDescription);
        //Messenger.AddListener<SpeakingResponse>(DiscordEvent.Voice.Speaking, OnSpeaking);
        Messenger.AddListener <byte[]>(DiscordEvent.Voice.Packet, OnPacket);
    }
示例#3
0
 public void Connect()
 {
     gateway = new DiscordGatewayClient(GatewayUrl);
 }
示例#4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DiscordService"/> class.
 /// </summary>
 /// <param name="gatewayClient">The <see cref="DiscordGatewayClient"/>.</param>
 /// <param name="logger">The <see cref="ILogger"/>.</param>
 public DiscordService(DiscordGatewayClient gatewayClient, ILogger <DiscordService> logger)
 {
     _gatewayClient = gatewayClient;
     _logger        = logger;
 }
示例#5
0
 public CrabotClient(DiscordGatewayClient discordGatewayClient)
 {
     _discordGatewayClient = discordGatewayClient;
 }
示例#6
0
 public ModixBot(DiscordGatewayClient client)
 => _client = client;