Skip to content

gibran-abdillah/chat-app

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

89 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Chat App

Group chat app built with Django, django-channels, and rest_framework

Table Of Contents

Installation

git clone https://github.com/gibran-abdillah/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

Setup

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!

Features

  • 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

Screenshots

Chat Section

Chat template i got from https://github.com/pamekasancode/webchat-js/tree/master (thx a lot for this guy)

new1 new2 Screenshot 2022-11-25 152358 Screenshot 2022-11-25 152419