mirror of
https://github.com/MrDetonia/Maki.git
synced 2024-11-13 00:26:53 -05:00
v0.18.0 added reload feature for auto-updating
This commit is contained in:
parent
8c4b5cf0e9
commit
1af33fb13c
32
bootstrap.sh
Executable file
32
bootstrap.sh
Executable file
@ -0,0 +1,32 @@
|
||||
#!/bin/bash
|
||||
|
||||
# user to effectively run bot as (so we can safely run as root for pip)
|
||||
puser="admin"
|
||||
|
||||
while :
|
||||
do
|
||||
date
|
||||
|
||||
echo Updating repository...
|
||||
runuser -m $puser -c 'git pull'
|
||||
|
||||
# if root we can update discord.py
|
||||
if [ "$EUID" -eq 0 ]
|
||||
then
|
||||
echo Updating discord.py...
|
||||
python3 -m pip install -U https://github.com/Rapptz/discord.py/archive/master.zip#egg=discord.py[voice]
|
||||
fi
|
||||
|
||||
echo Starting Maki...
|
||||
runuser -m $puser -c 'rm -f ./reload'
|
||||
runuser -m $puser -c 'python3 bot.py'
|
||||
|
||||
# okay to quit if rval was not 0
|
||||
if [ ! -f ./reload ]
|
||||
then
|
||||
echo no reload file, stopping for realsies...
|
||||
exit
|
||||
fi
|
||||
done
|
||||
|
||||
exit
|
7
bot.py
7
bot.py
@ -31,7 +31,7 @@ from secret import token, lfmkey
|
||||
# CONFIGURATION
|
||||
|
||||
# bot version
|
||||
version = "v0.17.5"
|
||||
version = "v0.18.0"
|
||||
|
||||
# text shown by .help command
|
||||
helptext = """I am a Discord bot written in Python
|
||||
@ -177,6 +177,11 @@ def on_message(message):
|
||||
run = False
|
||||
yield from client.send_message(message.channel, 'But will I dream? ;_;')
|
||||
yield from client.logout()
|
||||
|
||||
if message.content[5:] == 'reload':
|
||||
# touch a file called 'reload' which signals we should restart
|
||||
with open('reload', 'a'):
|
||||
os.utime('reload', None)
|
||||
else:
|
||||
# user not admin, refuse
|
||||
response = 'Don\'t be so rude! >:('
|
||||
|
Loading…
Reference in New Issue
Block a user