예제 #1
0
        public GoogleCommandsModule(IKarvisConfigurationService configurationService)
        {
            KarvisConfiguration = configurationService.Configuration;

            AssistantConfig = new AssistConfig()
            {
                AudioOutConfig = new AudioOutConfig()
                {
                    Encoding         = AudioOutConfig.Types.Encoding.Linear16,
                    SampleRateHertz  = 16000,
                    VolumePercentage = 100
                },
                DeviceConfig = new DeviceConfig()
                {
                    DeviceId      = KarvisConfiguration.GoogleAssistantConfiguration.DeviceId,
                    DeviceModelId = KarvisConfiguration.GoogleAssistantConfiguration.DeviceModelId
                },
                DialogStateIn = new DialogStateIn()
                {
                    IsNewConversation = true,
                    LanguageCode      = "en-US"
                },
                DebugConfig = new DebugConfig()
                {
                    ReturnDebugInfo = true
                },
                ScreenOutConfig = new ScreenOutConfig()
                {
                    ScreenMode = ScreenOutConfig.Types.ScreenMode.Playing
                }
            };
        }
예제 #2
0
 public AzureSpeechModule(KarvisConfiguration configuration, DebugLogger debugLogger)
 {
     DebugLogger  = debugLogger;
     SpeechConfig = SpeechConfig.FromSubscription(configuration.AzureSpeechConfiguration.SubscriptionKey, configuration.AzureSpeechConfiguration.Region);
 }
예제 #3
0
 public GoogleOAuth(KarvisConfiguration configuration)
 {
     KarvisConfiguration = configuration;
 }
예제 #4
0
 public CommandsModule(IKarvisConfigurationService configuration)
 {
     //ServiceProvider = serviceProvider;
     KarvisConfiguration = configuration.Configuration;
 }
예제 #5
0
파일: Program.cs 프로젝트: A7250AG/Karvis
        static async Task MainAsync(string[] args)
        {
            // Create service collection and configure our services
            var serviceProvider = new ServiceCollection()
                                  .AddSingleton <IKarvisConfigurationService>(new KarvisConfigurationService())
                                  .AddSingleton <IProvideAudioState>(new AudioStateProvider())
                                  .BuildServiceProvider();

            karvisConfiguration = serviceProvider.GetService <IKarvisConfigurationService>().Configuration;

            discord = new DiscordClient(new DSharpPlus.DiscordConfiguration()
            {
                Token                 = karvisConfiguration.DiscordConfiguration.Token,
                TokenType             = TokenType.Bot,
                UseInternalLogHandler = true,
                LogLevel              = LogLevel.Debug,
                AutoReconnect         = true
            });

            var audioConfig = new VoiceNextConfiguration();

            audioConfig.AudioFormat    = new AudioFormat(48000, 2, VoiceApplication.Music);
            audioConfig.EnableIncoming = true;
            voice = discord.UseVoiceNext(audioConfig);

            discord.MessageCreated += async e =>
            {
                if (e.Message.Content.ToLower().StartsWith("ping"))
                {
                    await e.Message.RespondAsync("pong!");
                }
            };

            commands = discord.UseCommandsNext(new CommandsNextConfiguration
            {
                StringPrefixes = new List <string>()
                {
                    ";;", "->"
                },
                EnableDms = false, // required for UseVoiceNext?
                Services  = serviceProvider
            });

            commands.RegisterCommands <CommandsModule>();
            commands.RegisterCommands <LavalinkCommandsModule>();
            commands.RegisterCommands <AzureCommandsModule>();
            commands.RegisterCommands <GoogleCommandsModule>();

            interactivity = discord.UseInteractivity(new InteractivityConfiguration
            {
            });

            lavalink = discord.UseLavalink();

            discord.Ready          += Client_Ready;
            discord.GuildAvailable += Client_GuildAvailable;
            discord.ClientErrored  += Client_ClientError;

            await discord.ConnectAsync();

            await Task.Delay(-1); // infinite wait to prevent exit
        }
예제 #6
0
 public AzureCommandsModule(IKarvisConfigurationService configuration)
 {
     KarvisConfiguration = configuration.Configuration;
 }