Skip to content

vladshut/be-challenge-2019

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

be-challenge-2019

Docker settings located in docker folder
Source code is located in src folder


Start project

cd docker
docker-compose up  --build -d nginx mysql phpmyadmin redis workspace laravel-echo-server
docker-compose exec --user=laradock  workspace composer install
docker-compose exec --user=laradock  workspace php artisan migrate

project api url is http://127.0.0.1:81/api/

project websocket url is http://127.0.0.1:1030



Sockets

For start listening to the new messages in the room you can use the following code:

<script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/1.7.4/socket.io.js"></script>
<script>
    const socket = io('http://127.0.0.1:1030');
    socket.emit('subscribe', {
        channel: 'laravel_database_chat.<ROOM_ID>'
    }).on('App\Events\Message', function (channel, data) {
        console.log(data);
    });
</script>


Run tests

cd docker && docker-compose exec --user=laradock  workspace composer test

Bot support

In each room of the chat you can communicate with built-in bot. Just type @bot Hi! and receive reply from the bot.
Bot is built using Dialogflow service. It has some predefined intents:

Welcome

EN

> @bot hi
> Wassup bro!

UK

> @bot привіт
> драстє


Fallback message

EN

> @bot How many apples are on the table?
> WTF?!

UK

> @bot Який там курс?
> Що за ...?


Today info (using context)

EN

> @bot today info
> 2019-07-07 Weather, holidays?

> @bot weather 
> 10 C rain

> @bot holidays
> Easter, Day of Medicine

UK

> @bot сьогодні інфо
> 2019-07-07 Погода, свята?

> @bot погода 
> 16 С Похмуро

> @bot свята
> День молоді, 1 квітня, День бобра


Switch language

EN

> @bot switch lang
> Ви обрали українську мову

UK

> @bot змінити мову
> Language changed to English


About

My solution

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published