Skip to content

Commit 8ebd397

Browse files
committed
Github pipeline setup
1 parent c85434f commit 8ebd397

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

bot.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
EMAIL_PASSWORD = config('userpass')
1414

1515
try:
16-
conn = psycopg2.connect(database = "managementbot", user = "postgres", password = "1234", host = "127.0.0.1", port = "5432")
16+
conn = psycopg2.connect(database = config('database'), user = config('user'), password = config('password'), host = config('host'), port = config('port'))
1717
print ("Opened database successfully")
1818
cur = conn.cursor()
1919

@@ -53,7 +53,7 @@ async def on_ready():
5353
@client.event
5454
async def on_message(message):
5555

56-
conn = psycopg2.connect(database = "managementbot", user = "postgres", password = "1234", host = "127.0.0.1", port = "5432")
56+
conn = psycopg2.connect(database = config('database'), user = config('user'), password = config('password'), host = config('host'), port = config('port'))
5757
print ("Opened database successfully")
5858
cur = conn.cursor()
5959

@@ -83,6 +83,8 @@ async def on_message(message):
8383
flag=1
8484
cur.execute("UPDATE DISCORDBOT set MSGCNT = %s where CHANNEL = %s and USERNAME = %s and SERVER = %s and DATE = %s", (int(int(row[2])+1), str(message.channel.name), str(message.author.name),str(message.guild),str(date.today())))
8585
print("(msgcnt,channel,username,server,DATE) updated in DISCORDBOT table")
86+
conn.commit()
87+
print("Updated Discord bot table")
8688
break
8789
if(flag==0):
8890
cur.execute("INSERT INTO DISCORDBOT (server,channel,USERNAME,MSGCNT,EMAIL,DATE,ROLES) VALUES (%s,%s,%s,1,'Not Updated',%s,%s)", (str(message.guild),str(message.channel.name), str(message.author.name), str(date.today()), str("!.#$%".join(role_str))))
@@ -92,6 +94,7 @@ async def on_message(message):
9294
cur.execute("INSERT INTO DISCORDBOT (server,channel,USERNAME,MSGCNT,EMAIL,DATE,ROLES) VALUES (%s,%s,%s,1,'Not Updated',%s,%s)", (str(message.guild),str(message.channel.name), str(message.author.name), str(date.today()), str("!.#$%".join(role_str))))
9395
print("(server,channel,USERNAME,MSGCNT,EMAIL,DATE,ROLES) inserted in DISCORDBOT table")
9496
conn.commit()
97+
print("Saved to DB")
9598

9699
if(message.guild.roles[-1].id==message.author.roles[-1].id):
97100

0 commit comments

Comments
 (0)