initial commit
This commit is contained in:
commit
4b47899a3d
5 changed files with 396 additions and 0 deletions
26
main.py
Normal file
26
main.py
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
import simplematrixbotlib as matrix
|
||||
from dotenv import dotenv_values
|
||||
|
||||
DOTENV = dotenv_values(".env")
|
||||
PREFIX = "!"
|
||||
|
||||
config = matrix.Config()
|
||||
config.encryption_enabled = True
|
||||
config.emoji_verify = True
|
||||
config.ignore_unverified_devices = True
|
||||
|
||||
creds = matrix.Creds(
|
||||
DOTENV["MATRIX_SERVER"], DOTENV["BOT_USERNAME"], DOTENV["BOT_PASSWORD"]
|
||||
)
|
||||
|
||||
bot = matrix.bot.Bot(creds, config)
|
||||
|
||||
|
||||
@bot.listener.on_message_event
|
||||
async def echo(room, message):
|
||||
mtch = matrix.match.MessageMatch(room, message, bot, PREFIX)
|
||||
if mtch.is_not_from_this_bot and mtch.prefix and mtch.command("echo"):
|
||||
await bot.api.send_text_message(room.room_id, " ".join(mtch.args()))
|
||||
|
||||
|
||||
bot.run()
|
||||
Loading…
Add table
Add a link
Reference in a new issue