From a14104e3db81f5ef26a602487123279d33a0346e Mon Sep 17 00:00:00 2001 From: vin Date: Sun, 14 Jan 2024 23:16:41 -0500 Subject: read messages from specified channels and print them --- main.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 main.py (limited to 'main.py') diff --git a/main.py b/main.py new file mode 100644 index 0000000..6c1b2b4 --- /dev/null +++ b/main.py @@ -0,0 +1,20 @@ +import os, discord + +intents = discord.Intents.default() +intents.message_content = True + +token = os.getenv("DISCORD_TOKEN") +client = discord.Client(intents=intents) + +channelids = [1196201613132574733] + +@client.event +async def on_ready(): + print(f"Logged in as {client.user}") + +@client.event +async def on_message(message): + if message.channel.id in channelids: + print(f"<{message.author.global_name}> {message.content}") + +client.run(token) -- cgit v1.2.3