Update app.py for new version of discord.py

This commit is contained in:
Aadi Desai 2023-02-08 14:49:59 +00:00 committed by GitHub
parent b93c401b77
commit 135f0b55da
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

4
app.py
View file

@ -2,7 +2,7 @@ from datetime import datetime
import discord, json, os, re import discord, json, os, re
from textwrap import indent from textwrap import indent
bot = discord.Client() bot = discord.Client(intents = discord.Intents.default())
listenChannelIDs = [ listenChannelIDs = [
250056894335549440, # ICAS - announcements 250056894335549440, # ICAS - announcements
960995261570756690, # ICAS - 4koma-archive 960995261570756690, # ICAS - 4koma-archive
@ -27,7 +27,7 @@ async def generate_contents():
await oldmsg.delete() await oldmsg.delete()
print(f"[INFO:] {datetime.now().ctime()} Deleted old Contents message ({contentsMsgID})") print(f"[INFO:] {datetime.now().ctime()} Deleted old Contents message ({contentsMsgID})")
bot_messages = [(contentsRegex.match(message.content).group(1), message.jump_url) bot_messages = [(contentsRegex.match(message.content).group(1), message.jump_url)
for message in await outputChannel.history(limit=1000).flatten() async for message in outputChannel.history(limit=1000)
if message.author == bot.user][::-1] if message.author == bot.user][::-1]
split_bot_messages = [bot_messages[i:i+10] for i in range(0, len(bot_messages), 10)] split_bot_messages = [bot_messages[i:i+10] for i in range(0, len(bot_messages), 10)]
grouped_bot_messages = [split_bot_messages[i:i+6] for i in range(0, len(split_bot_messages), 6)] grouped_bot_messages = [split_bot_messages[i:i+6] for i in range(0, len(split_bot_messages), 6)]