fix
This commit is contained in:
12
c/update.py
12
c/update.py
@@ -17,21 +17,21 @@ class Update(commands.Cog):
|
|||||||
Make pull from git repository and restart
|
Make pull from git repository and restart
|
||||||
|
|
||||||
"""
|
"""
|
||||||
res = await self.bot.ch(server_id=context.guild.id)
|
try:
|
||||||
channel = self.bot.get_channel(int(res))
|
res = await self.bot.ch(server_id=context.guild.id)
|
||||||
|
channel = self.bot.get_channel(int(res))
|
||||||
|
except:
|
||||||
|
channel = context
|
||||||
await channel.send('restarting...')
|
await channel.send('restarting...')
|
||||||
try:
|
try:
|
||||||
subprocess.run(["git", "pull", "origin", "main"],capture_output=True)
|
subprocess.run(["git", "pull", "origin", "main"],capture_output=True)
|
||||||
|
await channel.send('restart successful')
|
||||||
except:
|
except:
|
||||||
await channel.send('restart fail')
|
await channel.send('restart fail')
|
||||||
return
|
return
|
||||||
|
|
||||||
python = sys.executable
|
python = sys.executable
|
||||||
os.execv(python, [python] + sys.argv)
|
os.execv(python, [python] + sys.argv)
|
||||||
try:
|
|
||||||
await channel.send('restart successful')
|
|
||||||
except:
|
|
||||||
print("rrrrr")
|
|
||||||
|
|
||||||
@commands.Cog.listener()
|
@commands.Cog.listener()
|
||||||
async def on_ready(self):
|
async def on_ready(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user