Group chat app built with Django, django-channels, and rest_framework
- Clone this repository https://github.com/AI-General/chat-app
git clone https://github.com/AI-General/chat-app
cd chat-app
- Activate the local environment
virtualenv env
source env/bin/activate
- Install the requirements
pip3 install -r requirements.txt
- Migrate the database
./manage.py makemigrations
./manage.py migrate
Go to app/settings.py to set your Redis url
CHANNEL_LAYERS = {
"default":{
"BACKEND":"channels_redis.core.RedisChannelLayer",
"CONFIG":{
"hosts":[('localhost', 6379)],
}
},
}
You can run the server by using command
./manage.py runserver
Create your bot!
./manage.py create_bot
Username for your bot : ganteng
File name to generate : bot_ganteng.py
Bot Description : Test
Message Handler (e.g : /hello,/fush,/foo) : /hello,/world
File created /home/vvvv/project/app/bots/bot_ganteng.py
User for bot created!
The command will automatically create a user for the bot, and save a file to execute bot commands
You can customize the response bot in the file that was created
async def execute_command(argument, group_room_code):
return "Change this response!"
Activate your bot in room settings!
- Login and Register
- Any logged in user can create a room
- Authenticated user can generate new room code, and delete their own room
- Basic Bot feature
- Messages saved to database
- Messages from not logged in user will no saved to database
Chat Section
Chat template i got from https://github.com/pamekasancode/webchat-js/tree/master (thx a lot for this guy)