Documentation is work in progress!
Discord.py is now deprecated so we're moving to an alternative ~ Pycord. Pycord is a fork of Discord.py being maintained from v1.7.3 onwards. The documentation to get started with Pycord can be found Here!
- Create a
.env
file in the root directory, if it exists proceed to Step 2. - Add the
.env
file to.gitignore
to ensure SECRET KEYS/TOKENS don't get committed.
- Use pipenv to manage dependencies etc.
- Execute
pipenv install
to install dependecies. - Run
main.py
usingpipenv run python main.py
- Note: The bot expects either the
BOT_TOKEN
passed in as an environement variable or within a.env
file in the project root directory.
- Note: The bot expects either the
- Login to/Create your Discord Developer account.
- Create a
New Application
from the dashboard, give the app a name to match the use. Eg: test-bot. - In the Application, click on
Bot
from the menu to the left. - Create a new bot on the Build-A-Bot page by clicking on the
New Bot
button. - Once the bot is created, you'll see a
Copy
button under Token on the bot page. - Paste the copied Token into the
.env
file in the project root directory.
VikeBot uses DynamoDB, which is a NoSQL database by Amazon. Below provides some brief instructions on how to setup a local instance of DynamoDB as well as a visual tool to interact with the database.
- Install a local DynamoDB instance.
- This can be anything but for the same of simplificty, we'll be using the AWS-provided Java version.
- For those who have Docker installed, that will probably be easier.
- Unzip the contents of the
zip
ortar.gz
file into a folder calledtmp
in the repository root folder. unzip dynamodb_local_latest.zip -d tmp
- Start the local DynamoDB instance.
java -Djava.library.path=./tmp/DynamoDBLocal_lib -jar ./tmp/DynamoDBLocal.jar -sharedDb
from the repository directory.- This will start the instance on port
8000
. Please read the AWS documentation for changing the port. - Congrats, you have a local DynamoDB instance!
Optional: If you wish to have a visual interface to interfact with DynamoDB, follow these steps!
dynamodb-admin is a Node.js based tool. You'll need to have Node.js and npm installed.
# For Windows:
set DYNAMO_ENDPOINT=http://localhost:8000
npx dynamodb-admin
# For Mac/Linux:
DYNAMO_ENDPOINT=http://localhost:8000 npx dynamodb-admin
Once the all of the above is setup, try playing around using the Python interrupter.
$ pipenv run python
Python 3.9.1 (default, Jan 20 2021, 00:00:00)
>>> from database import *
# let's create a document
u = DiscordUserModel(100)
# save the document
u.save()