adding sqlite3 database

This commit is contained in:
Mylloon 2021-06-03 08:07:53 +02:00
parent 891195b1d5
commit 6f507b8d29
4 changed files with 9 additions and 2 deletions

1
.gitignore vendored
View file

@ -2,3 +2,4 @@
update/ update/
__pycache__/ __pycache__/
.envrc .envrc
src/db/*

View file

@ -7,7 +7,7 @@
[![Github forks](https://img.shields.io/github/forks/Confrerie-du-Kassoulait/KassouBot?label=Github%20Forks&style=for-the-badge)](https://github.com/Confrerie-du-Kassoulait/KassouBot/network) [![Github forks](https://img.shields.io/github/forks/Confrerie-du-Kassoulait/KassouBot?label=Github%20Forks&style=for-the-badge)](https://github.com/Confrerie-du-Kassoulait/KassouBot/network)
## __Setting up__ ## __Setting up__
You have to replace `TOKEN_DISCORD`, `PREFIX`, `TOKEN_GENIUS`, `TOKEN_REDDIT_CLIENT_ID`, `TOKEN_REDDIT_CLIENT_SECRET`, `TOKEN_REDDIT_USER_AGENT` and [`TIMEZONE`](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones) with your desired values. You have to replace `TOKEN_DISCORD`, `PREFIX`, `TOKEN_GENIUS`, `TOKEN_REDDIT_CLIENT_ID`, `TOKEN_REDDIT_CLIENT_SECRET`, `TOKEN_REDDIT_USER_AGENT` and [`TIMEZONE`](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones) with your desired values. You must also specify a path to the folder where the database will be.
With a [docker-compose](https://github.com/Confrerie-du-Kassoulait/KassouBot/blob/master/docker-compose.yml) or in command line: With a [docker-compose](https://github.com/Confrerie-du-Kassoulait/KassouBot/blob/master/docker-compose.yml) or in command line:
``` ```
@ -20,7 +20,8 @@ docker run -d \
--TOKEN_REDDIT_CLIENT_SECRET="yourRedditClientSecret" \ --TOKEN_REDDIT_CLIENT_SECRET="yourRedditClientSecret" \
--TOKEN_REDDIT_USER_AGENT="yourRedditUserAgent" \ --TOKEN_REDDIT_USER_AGENT="yourRedditUserAgent" \
--TIMEZONE="yourTimezone" \ --TIMEZONE="yourTimezone" \
--PREFIX="yourPrefix" --PREFIX="yourPrefix" \
-v /here/your/path/:/src/db/
``` ```
To find reddit tokens, go to [this site](https://www.reddit.com/prefs/apps) and here are the instructions: ![instructions](https://i.imgur.com/tEzYKDA.png) To find reddit tokens, go to [this site](https://www.reddit.com/prefs/apps) and here are the instructions: ![instructions](https://i.imgur.com/tEzYKDA.png)

View file

@ -11,4 +11,6 @@ services:
- TOKEN_REDDIT_USER_AGENT=yourRedditUserAgent - TOKEN_REDDIT_USER_AGENT=yourRedditUserAgent
- TIMEZONE=yourTimezone # More info here: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones - TIMEZONE=yourTimezone # More info here: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
- PREFIX=yourPrefix - PREFIX=yourPrefix
volumes:
- /here/your/path/bot.sqlite3:/src/db/bot.sqlite3
restart: unless-stopped restart: unless-stopped

3
src/utils/db.py Normal file
View file

@ -0,0 +1,3 @@
import sqlite3
con = sqlite3.connect('../db/bot.sqlite3')