Coder Social home page Coder Social logo

apurer / interactive-chat-bot Goto Github PK

View Code? Open in Web Editor NEW
23.0 1.0 10.0 19 KB

Tutorial on how to build simple discord chat bot using discord.py and DialoGPT.

Home Page: https://www.youtube.com/watch?v=cxBDwhblpgE

License: MIT License

Python 100.00%
discord-bot ai-chatbot python3 dialogpt discord-py

interactive-chat-bot's Introduction

Discord interactive chat bot assembled using discord.py and DialoGPT.

Requirements:

  • Ubuntu terminal
  • Discord account
  • At least 2GB of RAM to run DialoGPT-small model, more if using larger model

Installation of dependencies:

In Ubuntu terminal run following commands.

$ sudo apt-get update
$ sudo apt-get install python3-pip libffi-dev libnacl-dev python3-dev

Change root password (if you know what it is ignore this step).

$ passwd 

Create user from which you are going to run bot to not run bot as root.

$ sudo adduser bot
$ su - bot
$ pip3 install -U torch==1.4.0+cpu torchvision==0.5.0+cpu -f https://download.pytorch.org/whl/torch_stable.html
$ pip3 install -U discord.py
$ pip3 install -U transformers

Alternatively if installation doesn't work follow instructions from:

Generating Discord Token:

  • Go to https://discordapp.com/developers/applications
  • Click "New Application"
  • Name it whatever you want (i named mine "ai-bot")
  • Click "Create"
  • Go to "Bot" tab (it's on the left side under settings)
  • Click "Add Bot"
  • Alert with "ADD A BOT TO THIS APP?" will appear, click "Yes, do it!"
  • Under Token click "Copy" for the next step

Setting up environment variable:

$ echo "export DISCORD_TOKEN=paste_your_token_here" >> ~/.bash_profile
$ source ~/.bash_profile

Adding bot to your server and giving it permissions:

  • Go back to your application view (if you haven't closed it from step "Generating Discord Token" you can skip sub steps for this bullet)
  • Under "Privileged Gateway Intents" toggle: -"MESSAGE CONTENT INTENT" as true
  • Go to OAuth2 tab (it's on the left side under "General Information")
  • Under "SCOPES" select:
    • "bot"
  • Under "URL Generator" select:
    • Send Messages
    • Read Message History
  • Go to Bot tab
  • From "GENERATED URL" area copy link
  • Paste copied link into your browser and select server you want to invite bot to
  • Click continue
  • Click Authorize
  • Pass capcha
  • Go to server you invited your bot
  • Depending on your server settings you might have to modify bot role to have permissions to use the channel and read / send messages

Running bot:

  • Go to terminal and run:
$ wget https://raw.githubusercontent.com/Apurer/interactive-chat-bot/master/ai-bot.py
$ python3 ai-bot.py
  • To stop bot from running press: CTRL + C

To run in bot background

  • Go to terminal and run:
$ chmod +x ai-bot.py
$ nohup ~/ai-bot.py &
  • To stop bot from running run command:
$ pkill -f ai-bot.py

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.