Skip to content

Commit 4c666bb

Browse files
authored
Prefix support
1 parent ff7559c commit 4c666bb

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

bot.py

+8-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838

3939
class Modmail(commands.Bot):
4040
def __init__(self):
41-
super().__init__(command_prefix='m.')
41+
super().__init__(command_prefix=self.get_pre)
4242
self.uptime = datetime.datetime.utcnow()
4343
self._add_commands()
4444

@@ -63,6 +63,13 @@ def token(self):
6363
except FileNotFoundError:
6464
token = None
6565
return os.environ.get('TOKEN') or token
66+
67+
@staticmethod
68+
async def get_pre(bot, message):
69+
'''Returns the prefix.'''
70+
with open('data/config.json') as f:
71+
prefix = json.load(f).get('PREFIX')
72+
return os.environ.get('PREFIX') or prefix or 'r.'
6673

6774
@staticmethod
6875
def run_wizard():

0 commit comments

Comments
 (0)