Fill out more of the update message method.
This commit is contained in:
@@ -31,9 +31,8 @@ class ClanMessages(commands.Cog, name="Clan Messages"):
|
|||||||
await server.serve()
|
await server.serve()
|
||||||
|
|
||||||
async def hello(self):
|
async def hello(self):
|
||||||
print("we did a webhook")
|
|
||||||
await self.update_messages()
|
await self.update_messages()
|
||||||
return {"message": "webhook get"}
|
return
|
||||||
|
|
||||||
async def update_messages(self):
|
async def update_messages(self):
|
||||||
"""
|
"""
|
||||||
@@ -46,15 +45,24 @@ class ClanMessages(commands.Cog, name="Clan Messages"):
|
|||||||
# posting involves checking if there is a message for that particular file then editing it or creating a
|
# posting involves checking if there is a message for that particular file then editing it or creating a
|
||||||
# new one. the message could be deleted, which would cause a new message to be sent and database updated.
|
# new one. the message could be deleted, which would cause a new message to be sent and database updated.
|
||||||
dirs = [
|
dirs = [
|
||||||
f"{MESSAGES_DIR}/{dir_name}"
|
dir_name
|
||||||
for dir_name in os.listdir(MESSAGES_DIR)
|
for dir_name in os.listdir(MESSAGES_DIR)
|
||||||
if os.path.isdir(f"{MESSAGES_DIR}/{dir_name}")
|
if os.path.isdir(f"{MESSAGES_DIR}/{dir_name}")
|
||||||
]
|
]
|
||||||
for dir_name in dirs:
|
for dir_name in dirs:
|
||||||
|
dir_path = f"{MESSAGES_DIR}/{dir_name}"
|
||||||
sorted_files = sorted(
|
sorted_files = sorted(
|
||||||
os.listdir(dir_name), key=lambda filename: int(filename.split(".")[0])
|
os.listdir(dir_path), key=lambda filename: int(filename.split(".")[0])
|
||||||
)
|
)
|
||||||
print(sorted_files)
|
for file_name in sorted_files:
|
||||||
|
file_path = f"{dir_path}/{file_name}"
|
||||||
|
with open(file_path, "r", encoding="utf8") as reader:
|
||||||
|
print(reader.read(2000))
|
||||||
|
|
||||||
|
# get the channel from dir_name
|
||||||
|
# if doesn't exist, make one
|
||||||
|
# write or edit message
|
||||||
|
# save message id if written
|
||||||
|
|
||||||
def repo_setup(self):
|
def repo_setup(self):
|
||||||
"""
|
"""
|
||||||
|
|||||||
Reference in New Issue
Block a user