read messages from specified channels and print them
This commit is contained in:
commit
a14104e3db
12
README
Normal file
12
README
Normal file
@ -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.
|
20
main.py
Normal file
20
main.py
Normal file
@ -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)
|
2
requirements.txt
Normal file
2
requirements.txt
Normal file
@ -0,0 +1,2 @@
|
||||
discord.py
|
||||
|
Loading…
Reference in New Issue
Block a user