Skip to content

Commit 3ebe55d

Browse files
committed
Fixed database port config
Signed-off-by: ColaIan <colaian.yt@gmail.com>
1 parent ad0b7ad commit 3ebe55d

File tree

4 files changed

+5
-3
lines changed

4 files changed

+5
-3
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
Teapot.py is an open source Discord bot that aims to be as customisable as possible as well as providing essential tools for server administrators to run their Discord server!
2323

24-
If you want to try it out by yourself, feel free to invite it to your Discord server by clicking [Here](https://discordapp.com/api/oauth2/authorize?client_id=669880564270104586&permissions=0&scope=bot)!
24+
If you want to try it out by yourself, feel free to invite it to your Discord server by clicking [Here](https://discordapp.com/oauth2/authorize?client_id=669880564270104586&permissions=8&scope=bot)!
2525

2626
## ⌨ Planned Features
2727
- Music Player

Teapot.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@
3838
db.execute("CREATE TABLE IF NOT EXISTS `users` (`user_id` BIGINT, `user_name` TINYTEXT, `user_discriminator` INT)")
3939
db.execute("CREATE TABLE IF NOT EXISTS `bot_logs` (`timestamp` TEXT, `type` TINYTEXT, `class` TINYTEXT, `message` "
4040
"MEDIUMTEXT)")
41-
print(f"Connected to database ({teapot.config.db_host()}) in {round(time.perf_counter() - time_start, 2)}s")
41+
print(
42+
f"Connected to database ({teapot.config.db_host()}:{teapot.config.db_port()}) in {round(time.perf_counter() - time_start, 2)}s")
4243

4344
db.execute("INSERT INTO `bot_logs`(timestamp, type, class, message) VALUES(%s, %s, %s, %s)",
4445
(teapot.time(), "BOT_START", __name__, "Initialized bot"))

teapot/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def db_host():
3030

3131

3232
def db_port():
33-
return os.environ['DB_PORT']
33+
return os.getenv('DB_PORT', "3306")
3434

3535

3636
def db_schema():

teapot/managers/database.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ def __init__():
2626
try:
2727
database = mysql.connector.connect(
2828
host=teapot.config.db_host(),
29+
port=teapot.config.db_port(),
2930
database=teapot.config.db_schema(),
3031
user=teapot.config.db_user(),
3132
passwd=teapot.config.db_password()

0 commit comments

Comments
 (0)