summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvin <git@vineetk.net>2024-01-14 23:16:41 -0500
committervin <git@vineetk.net>2024-01-14 23:16:41 -0500
commita14104e3db81f5ef26a602487123279d33a0346e (patch)
tree7016f8a2298cd7d1ce2e5d46707e3c7f32d2d761
read messages from specified channels and print them
-rw-r--r--README12
-rw-r--r--main.py20
-rw-r--r--requirements.txt2
3 files changed, 34 insertions, 0 deletions
diff --git a/README b/README
new file mode 100644
index 0000000..d8963a3
--- /dev/null
+++ b/README
@@ -0,0 +1,12 @@
+dmab - Discord-Matrix Announcement Bridge
+=========================================
+A Discord and Matrix bot bridge that reads messages from a Discord channel
+and sends them to a Matrix channel.
+
+This is meant for announcement type channels but can be adapted to be a proper
+full bridge, but is currently out of scope for this program.
+
+Rationale
+---------
+The current (as of January 14, 2024) matrix-appservice-discord bridge does not
+support bridging Discord channels of type announcement.
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)
diff --git a/requirements.txt b/requirements.txt
new file mode 100644
index 0000000..c0e500d
--- /dev/null
+++ b/requirements.txt
@@ -0,0 +1,2 @@
+discord.py
+