maybe fixes none type error and that already is running

This commit is contained in:
jenz 2022-06-12 02:36:45 +02:00
parent c0d9cfa343
commit ba1fe9c5b6

View File

@ -9,7 +9,7 @@ import time
import traceback
import datetime
client = discord.Client()
clientI = discord.Client()
ignore_list = [846756271910158378]
#shit api. got switched like 1 year ago so like every single discusison about it is outdated.
@ -35,13 +35,14 @@ def get_suggestion_type(msg):
msg = msg.replace('!meta', '')
return suggestion_type, msg.strip()
@client.event
@clientI.event
async def on_message(message):
if message.author.bot:
return
if message.channel.name == 'suggestion-box': #suggestion-box
channel = client.get_channel(872925751295504476) #872925751295504476
message_content = message.content
global clientI
channel_suggestion_admin = clientI.get_channel(872925751295504476)
#print('message_content: ', message_content)
suggestion_type, message_content = get_suggestion_type(message_content)
now = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
@ -50,14 +51,14 @@ async def on_message(message):
print('send_channel_msg: ', send_channel_msg)
print('send_msg: ', send_msg)
await message.channel.send(send_channel_msg)
await channel.send(send_msg)
await channel_suggestion_admin.send(send_msg)
j = None
@loop(seconds = 10)
async def check_suggestions_to_delete():
global j
global client
for channel in client.get_all_channels():
global clientI
for channel in clientI.get_all_channels():
if channel.name == 'suggestion-admin':
msgs_history = channel.history()
j1 = await msgs_history.flatten()
@ -94,13 +95,15 @@ async def check_suggestions_to_delete():
try:
await msg.edit(content=final_msg)
except Exception:
traceback.print_exc()
time.sleep(300)
err = traceback.format_exc()
print("err traceback: ", err)
"""
client = discord.Client()
check_suggestions_to_delete.start()
client.run(token)
"""
#the entire syntax that is visisble from python3 terminal is not very well displayed in the docs of discord.py and nobody has the current syntax in any suggestions anywhere on the internet. almost every single thing is out of date reee
if __name__ == '__main__':
check_suggestions_to_delete.start()
client.run(token)
clientI.run(token)