コード例 #1
0
        public async Task RunBotAsync()
        {
            _client   = new DiscordSocketClient();
            _commands = new CommandService();
            var comModule = new Coms(_userNick);

            _mmiComms = comModule.GetMmic();
            _service  = new ServiceCollection()
                        .AddSingleton(_client)
                        .AddSingleton(_commands)
                        .BuildServiceProvider();
            _tts             = new Tts(comModule);
            _speechTemplates = new SpeechTemplates();

            _client.Log += Log;
            await RegisterCommandsAsync();

            _mmiComms.Message += MmiC_Message; // subscribe to the messages that come from the comMudole
            _mmiComms.Start();


            await _client.LoginAsync(TokenType.Bot, _botToken);


            await _client.StartAsync();

            _tts.Speak("Olá eu sou o wally, o teu bot do Discord! Se desejares podes-me perguntar o que é que eu sou capaz de fazer e que comandos estão disponíveis. So tenho um requisito, diz o meu nome antes de qualquer comando.");

            Thread.Sleep(2000);

            comModule.SendGuildInfo(_client.Guilds);
            await Task.Delay(-1);
        }
コード例 #2
0
        public MainWindow()
        {
            UserCredential credentials;

            using (var stream =
                       new FileStream("credentials.json", FileMode.Open, FileAccess.Read))
            {
                // The file token.json stores the user's access and refresh tokens, and is created
                // automatically when the authorization flow completes for the first time.
                string credPath = "token.json";
                credentials = GoogleWebAuthorizationBroker.AuthorizeAsync(
                    GoogleClientSecrets.Load(stream).Secrets,
                    Scopes,
                    "user",
                    CancellationToken.None,
                    new FileDataStore(credPath, true)).Result;
                Console.WriteLine("Credential file saved to: " + credPath);
            }

            // Create Google Calendar API service.
            service = new CalendarService(new BaseClientService.Initializer()
            {
                HttpClientInitializer = credentials,
                ApplicationName       = ApplicationName,
            });

            InitializeComponent();


            mmiC          = new MmiCommunication("localhost", 8000, "User1", "GUI");
            mmiC.Message += MmiC_Message;
            mmiC.Start();
        }
コード例 #3
0
        public MainWindow()
        {
            InitializeComponent();

            this.main = this;

            this.screenWidth  = System.Windows.SystemParameters.PrimaryScreenWidth;
            this.screenHeight = System.Windows.SystemParameters.PrimaryScreenHeight;

            this.Height = 55;
            this.Width  = this.maxWindowWidth;

            this.Top  = screenHeight - this.Height + 7;
            this.Left = screenWidth - this.Width + 7;

            this.Topmost = true;

            this.Show();

            this.sm = new Speaking();

            mmiC          = new MmiCommunication("localhost", 8000, "User1", "GUI");
            mmiC.Message += MmiC_Message;
            mmiC.Start();

            //UpdateKinectStatus("active");
        }
コード例 #4
0
        public MainWindow()
        {
            worker = new SpotifyWorker();

            mmiC          = new MmiCommunication("localhost", 8000, "User1", "GUI");
            mmiC.Message += MmiC_Message;
            mmiC.Start();
        }
コード例 #5
0
        public MainWindow()
        {
            InitializeComponent();


            mmiC          = new MmiCommunication("localhost", 8000, "User1", "GUI");
            mmiC.Message += MmiC_Message;
            mmiC.Start();
        }
コード例 #6
0
        /*
         * private void configureJarbas()
         * {
         * acceptingVoiceInput = false;
         *
         * if(Properties.Settings.Default.firstRun)
         * {
         *     t.Speak("Olá! Eu sou o Jarbas, o seu assistente no Windows. " +
         *     "Como esta é a minha primeira execução, vou-lhe fazer algumas perguntas. " +
         *     "Como é que deseja ser tratado?");
         * }
         * else
         * {
         *     t.Speak("Vamos dar início à configuração do Jarbas. " +
         *     "Como é que deseja ser tratado?");
         * }
         *
         * askForVoiceConfig(false);
         * }
         */
        /*
         * private static void warnUserTimeout()
         * {
         *  rnd = new Random();
         *  t.Speak(_timeoutMessages[rnd.Next(0, _timeoutMessages.Length)]);
         * }
         *
         * private void updateTimestamp()
         * {
         *  Console.WriteLine("updating timestamp");
         *  timeStamp = long.Parse(DateTime.Now.ToString("yyyyMMddHHmmssffff"));
         * }
         */
        private void init()
        {
            //if (!Properties.Settings.Default.configured)
            //configureJarbas();
            //else
            sayHello();

            mmiC.Start();
        }
コード例 #7
0
 public MainWindow()
 {
     InitializeComponent();
     _t    = new Tts();
     _calc = new Calculator();
     _t.Speak(chooseRandomSpeech("greeting"));
     mmiC          = new MmiCommunication("localhost", 8000, "User1", "GUI");
     mmiC.Message += MmiC_Message;
     mmiC.Start();
 }
コード例 #8
0
        public MainWindow()
        {
            InitializeComponent();

            mpcHomeCinema = new MPCHomeCinema("http://localhost:13579");

            mmiC          = new MmiCommunication("localhost", 8000, "User1", "GUI");
            mmiC.Message += MmiC_Message;
            mmiC.Start();
        }
コード例 #9
0
        public Form1()
        {
            InitializeComponent();
            this.coord.GetLocationEvent();

            mmiC          = new MmiCommunication("localhost", 8000, "User1", "GUI");
            command       = new browserCommands();
            mmiC.Message += MmiC_Message;

            mmiC.Start();
        }
コード例 #10
0
        public MainWindow()
        {
            InitializeComponent();

            _client = new DiscordWebhookClient(643897438297391124, "-Jpr2aw_HQeS5iLVhC0TQzc7d9y4tTAp55aZZgfBvJvDuKjjmfxYGgcEEcLe3lnnAwyF");

            mmiC          = new MmiCommunication("localhost", 8000, "User1", "GUI");
            mmiC.Message += MmiC_Message;
            mmiC.Start();
            t = new Tts();
        }
コード例 #11
0
        public MainWindow()
        {
            InitializeComponent();


            lce_speechMod  = new LifeCycleEvents("ASR", "FUSION", "speech-2", "acoustic", "command");
            mmic_speechMod = new MmiCommunication("localhost", 8000, "User2", "ASR");
            mmic_speechMod.Send(lce_speechMod.NewContextRequest());

            mmiC          = new MmiCommunication("localhost", 8000, "User1", "GUI");
            mmiC.Message += MmiC_Message;
            mmiC.Start();
        }
コード例 #12
0
        private void init()
        {
            if (!Properties.Settings.Default.configured)
            {
                configureJarbas();
            }
            else
            {
                sayHello();
            }

            mmiC.Start();
        }
コード例 #13
0
ファイル: Form2.cs プロジェクト: davidd1995/IM2
        public Form2()
        {
            InitializeComponent();
            t.Speak("Olá, bem vindo ao Web browser!");
            t.Speak("Vamos começar!");
            t.Speak("Em que posso ajudar?");
            webBrowser1.ScriptErrorsSuppressed = true;
            webBrowser1.GoHome();


            mmiC          = new MmiCommunication("localhost", 8000, "User1", "GUI");
            mmiC.Message += MmiC_Message;
            mmiC.Start();
        }
コード例 #14
0
        public MainWindow()
        {
            /* Start API controllers */
            //this.worker = new SpotifyWorker();
            this.local_worker = new SpotifyLocalWorker();
            this.web_worker   = new SpotifyWebWorker();

            /* Start Text to Speech Module - TTS */
            this.tts = new TTS();

            mmiC          = new MmiCommunication("localhost", 8000, "User1", "GUI");
            mmiC.Message += MmiC_Message;
            mmiC.Start();
        }
コード例 #15
0
 public MainWindow()
 {
     InitializeComponent();
     _t    = new Tts();
     _calc = new Calculator();
     _t.Speak(chooseRandomSpeech("greeting"));
     _beggining = true; _confirmation = false;
     _lastNum1  = ""; _lastNum2 = ""; _lastOp = "";
     confidence = 0;
     InitializeComponent();
     mmiC          = new MmiCommunication("localhost", 8000, "User1", "GUI");
     mmiC.Message += MmiC_Message;
     mmiC.Start();
 }
コード例 #16
0
        public MainWindow()
        {
            InitializeComponent();


            mmiC          = new MmiCommunication("localhost", 8000, "User1", "GUI");
            mmiC.Message += MmiC_Message;
            mmiC.Start();
            oPowerPoint   = new PowerPoint.Application();
            oPresentation = oPowerPoint.Presentations.Add();
            examplePresentation();
            openpowerpoint   = true;
            presentationMode = false;
        }
コード例 #17
0
        public MainWindow()
        {
            InitializeComponent();

            PresentationPage initialPage = new PresentationPage(this);

            this.Content = initialPage;

            speakFinish = true;

            AppDomain.CurrentDomain.ProcessExit += CurrentDomain_ProcessExit;
            mmiC          = new MmiCommunication("localhost", 8000, "User1", "GUI");
            mmiC.Message += MmiC_Message;
            mmiC.Start();

            dManager = new ModalitiesManager(this);
        }
コード例 #18
0
        public MainWindow()
        {
            InitializeComponent();
            gsl = new GameStateListener(3000);
            gsl.NewGameState += new NewGameStateHandler(OnNewGameState);
            if (!gsl.Start())
            {
                Environment.Exit(0);
            }

            gamestate.money         = 800;
            gamestate.round_counter = 0;

            Console.WriteLine("Listening... n\n");

            //t.Speak("Por favor, espere um pouco enquanto tentamos conectar...");
            mmiC          = new MmiCommunication("localhost", 8000, "User1", "GUI");
            mmiC.Message += MmiC_Message;
            mmiC.Start();
        }
コード例 #19
0
        public MainWindow()
        {
            InitializeComponent();

            t.Speak("Wait a few seconds, we are just getting everything ready for you!");
            SpotifyAPI spotifyAPI = new SpotifyAPI();

            webSpotify = spotifyAPI.getAPI();
            spotify    = new SpotifyLocalAPI(new SpotifyLocalAPIConfig
            {
                Port    = 4381,
                HostUrl = "http://localhost"
            });
            if (!SpotifyLocalAPI.IsSpotifyRunning())
            {
                t.Speak("Spotify is not running, can you please turn it on ?");
                return; //Make sure the spotify client is running
            }
            if (!SpotifyLocalAPI.IsSpotifyWebHelperRunning())
            {
                t.Speak("Spotify WebHelper is not running");
                return; //Make sure the WebHelper is running
            }

            if (!spotify.Connect())
            {
                t.Speak("Spotify is not connected.");
                return; //We need to call Connect before fetching infos, this will handle Auth stuff
            }

            StatusResponse status = spotify.GetStatus(); //status contains infos

            t.Speak("You can close the browser now, hope you have a good time with our application");

            mmiC          = new MmiCommunication("localhost", 8000, "User1", "GUI");
            mmiC.Message += MmiC_Message;
            mmiC.Start();
        }
コード例 #20
0
        public MainWindow()
        {

            InitializeComponent();

            this.WindowState = WindowState.Minimized;
            this.ShowInTaskbar = false;

            minWordCount = 3;
            minWordLen = 4;

            driver = new ChromeDriver(".");
            driver.Manage().Window.Maximize();
            System.Threading.Thread.Sleep(3000);
            sim = new InputSimulator();
            tabs = driver.WindowHandles.ToList();

            mmiC = new MmiCommunication("localhost", 8000, "User1", "GUI");
            mmiC.Message += MmiC_Message;
            mmiC.Start();
            

        }
コード例 #21
0
        public MainWindow()
        {
            // Initialize the Chrome Driver
            driver = new ChromeDriver();
            wait   = new WebDriverWait(driver, TimeSpan.FromSeconds(15));

            thread = new Thread(scrollSmooth);
            thread.Start();

            t = new Tts();

            openUberEatsChrome(driver);

            mmiC          = new MmiCommunication("localhost", 8000, "User1", "GUI");
            mmiC.Message += MmiC_Message;

            mmiC.Start();


            Console.WriteLine("\nbefore driver...");

            Console.WriteLine("after driver function...\n");
        }
コード例 #22
0
        public SpeechMod(System.Windows.Shapes.Ellipse circle, System.Windows.Threading.Dispatcher dispatcher)
        {
            //init LifeCycleEvents..
            this.circle     = circle;
            this.Dispatcher = dispatcher;



            // CHANGED FOR FUSION ---------------------------------------

            lce  = new LifeCycleEvents("ASR", "FUSION", "speech-1", "acoustic", "command");
            mmic = new MmiCommunication("localhost", 9876, "User1", "ASR");
            mmic.Start();
            // END CHANGED FOR FUSION------------------------------------

            mmic.Send(lce.NewContextRequest());

            mmiC          = new MmiCommunication("localhost", 8000, "User2", "GUI");
            mmiC.Message += MmiC_Message;
            mmiC.Start();

            //load pt recognizer
            sre = new SpeechRecognitionEngine(new System.Globalization.CultureInfo("pt-PT"));
            gr  = new Grammar(Environment.CurrentDirectory + "\\grammarInitial.grxml", "rootRule");
            sre.LoadGrammar(gr);


            sre.SetInputToDefaultAudioDevice();
            sre.RecognizeAsync(RecognizeMode.Multiple);
            sre.SpeechRecognized   += Sre_SpeechRecognized;
            sre.SpeechHypothesized += Sre_SpeechHypothesized;

            tts = new Tts();
            // introduce assistant
            Speak("Olá, eu sou o seu assistente do PowerPoint, em que lhe posso ser util?", 5);
        }
コード例 #23
0
        public MainWindow()
        {
            commandsNotUnderstand[0] = "Desculpe, pode repetir?";
            commandsNotUnderstand[1] = "Parece que estou a ficar surda, importa-se de repetir?";
            commandsNotUnderstand[2] = "Pode repetir o que disse?";
            commandsNotUnderstand[3] = "Não queria ser inconveniente, mas pode repetir?";
            commandsNotUnderstand[4] = "Não percebi o que disse.";
            t = new Tts();

            driver = new ChromeDriver();


            //t.Speak("2");


            openUberEatsChrome(driver);

            mmiC          = new MmiCommunication("localhost", 8000, "User1", "GUI");
            mmiC.Message += MmiC_Message;
            //t.Speak("3");
            mmiC.Start();

            //t.Speak("4");
            Console.WriteLine("before driver...");

            Console.WriteLine("after driver function...");

            //t.Speak("coccocosocoasodasdas");
            //t.Speak("5");

            //there is something wrogn with the t.Speak
            //maybe assync


            //t.Speak("olá, tudo");
        }
コード例 #24
0
 public void StartComms(MmiCommunication mmiC)
 {
     mmiC.Start();
 }