Maybe hint how to mention us.
authorCMDR furrycat <elite@furrycat.net>
Tue, 23 May 2017 09:01:37 +0000 (10:01 +0100)
committerCMDR furrycat <elite@furrycat.net>
Tue, 23 May 2017 09:01:37 +0000 (10:01 +0100)
app.py
plugin/faction/faction.py

diff --git a/app.py b/app.py
index 5bcbb6a..a61c234 100644 (file)
--- a/app.py
+++ b/app.py
@@ -333,6 +333,8 @@ async def on_message(message):
   log.debug('Got message from {}: {}'.format(message.author, message.content))
   if not mentioned_in(message):
     log.debug('Message is not for me!')
+    if re.match(r'\b{}\b'.format(message.server.me.name), message.content):
+      await bot.maybe_say(message.channel, message.server.me.mention, probability = 0.1, wake = False)
     return
   if message.author.bot:
     log.debug('Ignoring message from bot!')
index b937f0c..ed0d3c6 100644 (file)
@@ -125,7 +125,7 @@ class Faction(DBConnection):
     return self.get_faction_ids([name]).get(name)
 
   def get_faction_name(self, id):
-    cursor = self.query('select name from faction_names where id=?', [id])
+    cursor = self.query('select name from faction_names where faction_id=?', [id])
     name = None
     for row in cursor.fetchone():
       name = row['name']