Compare commits
No commits in common. "8deaabf5d8d71c1fac7eecfbdbf0ca076d1ecccd" and "96ba32b610648aa3a45a6beac0ad58e7dcf1b046" have entirely different histories.
8deaabf5d8
...
96ba32b610
3 changed files with 1 additions and 35 deletions
27
bot.py
27
bot.py
|
@ -22,7 +22,6 @@ else:
|
||||||
|
|
||||||
print("Logging in…")
|
print("Logging in…")
|
||||||
credentials = botLibrary.Creds(config['matrix']['server'], config['matrix']['userid'], config['matrix']['password'])
|
credentials = botLibrary.Creds(config['matrix']['server'], config['matrix']['userid'], config['matrix']['password'])
|
||||||
admin = config['bot']['admin']
|
|
||||||
bot = botLibrary.Bot(credentials)
|
bot = botLibrary.Bot(credentials)
|
||||||
PREFIX = "!q"
|
PREFIX = "!q"
|
||||||
print("Logged in.")
|
print("Logged in.")
|
||||||
|
@ -42,7 +41,6 @@ async def help_message(room, message):
|
||||||
{PREFIX} get - fetch a image from the defined instance
|
{PREFIX} get - fetch a image from the defined instance
|
||||||
{PREFIX} source - send a link to the source code
|
{PREFIX} source - send a link to the source code
|
||||||
{PREFIX} version - show the bot version
|
{PREFIX} version - show the bot version
|
||||||
{PREFIX} die - kills the bot (only admins can do this!)
|
|
||||||
""")
|
""")
|
||||||
else:
|
else:
|
||||||
message = (f"""
|
message = (f"""
|
||||||
|
@ -53,7 +51,6 @@ async def help_message(room, message):
|
||||||
{PREFIX} get - fetch a image from the defined instance
|
{PREFIX} get - fetch a image from the defined instance
|
||||||
{PREFIX} source - send a link to the source code
|
{PREFIX} source - send a link to the source code
|
||||||
{PREFIX} version - show the bot version
|
{PREFIX} version - show the bot version
|
||||||
{PREFIX} die - kills the bot (only admins can do this!)
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
@ -145,28 +142,4 @@ async def help_message(room, message):
|
||||||
|
|
||||||
await bot.api.send_text_message(room.room_id, message)
|
await bot.api.send_text_message(room.room_id, message)
|
||||||
|
|
||||||
@bot.listener.on_message_event
|
|
||||||
async def help_message(room, message):
|
|
||||||
match = botLibrary.MessageMatch(room, message, bot, PREFIX)
|
|
||||||
if not (match.is_not_from_this_bot() and match.prefix() and match.is_from_userid(admin)
|
|
||||||
and match.command("die")):
|
|
||||||
return
|
|
||||||
|
|
||||||
message = ("Ok")
|
|
||||||
|
|
||||||
await bot.api.send_text_message(room.room_id, message)
|
|
||||||
exit(0)
|
|
||||||
|
|
||||||
# We should find a better way to do this.
|
|
||||||
@bot.listener.on_message_event
|
|
||||||
async def help_message(room, message):
|
|
||||||
match = botLibrary.MessageMatch(room, message, bot, PREFIX)
|
|
||||||
if not (match.is_not_from_this_bot() and match.prefix() and not match.is_from_userid(admin)
|
|
||||||
and match.command("die")):
|
|
||||||
return
|
|
||||||
|
|
||||||
message = ("You don't have permissions for that.")
|
|
||||||
|
|
||||||
await bot.api.send_text_message(room.room_id, message)
|
|
||||||
|
|
||||||
bot.run()
|
bot.run()
|
||||||
|
|
|
@ -9,7 +9,6 @@
|
||||||
"server": "https://quotes.example.com"
|
"server": "https://quotes.example.com"
|
||||||
},
|
},
|
||||||
"bot": {
|
"bot": {
|
||||||
"debugMode": true,
|
"debugMode": true
|
||||||
"admin": "@alice:example.com"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
6
fetch.py
6
fetch.py
|
@ -32,10 +32,4 @@ def fetchQuoteData(quoteId):
|
||||||
print(f"An error occured while saving the file: {quoteData.status_code}")
|
print(f"An error occured while saving the file: {quoteData.status_code}")
|
||||||
return "This file probably doesn't exist."
|
return "This file probably doesn't exist."
|
||||||
|
|
||||||
def fetchTopQuotes(instance):
|
|
||||||
raise NotImplementedError
|
|
||||||
|
|
||||||
def fetchBottomQuotes(instance):
|
|
||||||
raise NotImplementedError
|
|
||||||
|
|
||||||
fetchQuoteData(178)
|
fetchQuoteData(178)
|
||||||
|
|
Loading…
Add table
Reference in a new issue