mirror of
https://github.com/myned/modufur.git
synced 2024-11-01 21:02:38 +00:00
Finished restart command
This commit is contained in:
parent
86311aba96
commit
ac17187b1a
2 changed files with 23 additions and 8 deletions
|
@ -0,0 +1,3 @@
|
||||||
|
import os, sys
|
||||||
|
|
||||||
|
os.execl(sys.executable, 'python3', 'run.py')
|
|
@ -11,6 +11,8 @@ except FileNotFoundError:
|
||||||
|
|
||||||
import asyncio
|
import asyncio
|
||||||
import discord
|
import discord
|
||||||
|
import os
|
||||||
|
import subprocess
|
||||||
import traceback
|
import traceback
|
||||||
from discord import utils
|
from discord import utils
|
||||||
from discord.ext import commands
|
from discord.ext import commands
|
||||||
|
@ -24,7 +26,7 @@ bot = commands.Bot(command_prefix=commands.when_mentioned_or(config['prefix']),
|
||||||
@bot.event
|
@bot.event
|
||||||
async def on_ready():
|
async def on_ready():
|
||||||
if isinstance(bot.get_channel(config['startup_channel']), discord.TextChannel):
|
if isinstance(bot.get_channel(config['startup_channel']), discord.TextChannel):
|
||||||
await bot.get_channel(config['startup_channel']).send('H3l1(0) hOw aR3? **H4vE dAy.** 🌈')
|
await bot.get_channel(config['startup_channel']).send('Hello how are? **Have day.** 🌈')
|
||||||
print('Connected.')
|
print('Connected.')
|
||||||
print('Username: ' + bot.user.name)
|
print('Username: ' + bot.user.name)
|
||||||
print('-------')
|
print('-------')
|
||||||
|
@ -36,18 +38,28 @@ async def on_ready():
|
||||||
async def die(ctx):
|
async def die(ctx):
|
||||||
try:
|
try:
|
||||||
if isinstance(bot.get_channel(config['startup_channel']), discord.TextChannel):
|
if isinstance(bot.get_channel(config['startup_channel']), discord.TextChannel):
|
||||||
await bot.get_channel(config['shutdown_channel']).send('Am g0 by3e333333eee. **H4v3 n1GhT.** 💤')
|
await bot.get_channel(config['shutdown_channel']).send('Am go bye. **Have night.** 💤')
|
||||||
await bot.close()
|
await bot.close()
|
||||||
print('-------')
|
print('-------')
|
||||||
print('Closed.')
|
print('Closed.')
|
||||||
except Exception:
|
except Exception:
|
||||||
await ctx.send(exc.base)
|
await ctx.send(exc.base + '\n```python' + traceback.format_exc(limit=1) + '```')
|
||||||
traceback.print_exc(limit=1)
|
traceback.print_exc(limit=1)
|
||||||
|
|
||||||
@bot.command(aliases=['res', 'r'])
|
@bot.command(name=',restart', aliases=[',res', ',r'], hidden=True)
|
||||||
@commands.is_owner()
|
@commands.is_owner()
|
||||||
async def restart(self, ctx):
|
async def restart(ctx):
|
||||||
pass
|
try:
|
||||||
|
if isinstance(bot.get_channel(config['startup_channel']), discord.TextChannel):
|
||||||
|
await bot.get_channel(config['shutdown_channel']).send('Am go :b: rite becc. **Have noon.** 💤')
|
||||||
|
process = subprocess.run(['python3', 'restart.py'])
|
||||||
|
print(process.returncode)
|
||||||
|
await bot.close()
|
||||||
|
print('-------')
|
||||||
|
print('Closed.')
|
||||||
|
except Exception:
|
||||||
|
await ctx.send(exc.base + '\n```python' + traceback.format_exc(limit=1) + '```')
|
||||||
|
traceback.print_exc(limit=1)
|
||||||
|
|
||||||
# Invite bot to bot owner's server
|
# Invite bot to bot owner's server
|
||||||
@bot.command(name=',invite', aliases=[',inv', ',link'], brief='Invite the bot', description='BOT OWNER ONLY\nInvite the bot to a server (Requires admin)', hidden=True)
|
@bot.command(name=',invite', aliases=[',inv', ',link'], brief='Invite the bot', description='BOT OWNER ONLY\nInvite the bot to a server (Requires admin)', hidden=True)
|
||||||
|
@ -57,7 +69,7 @@ async def invite(ctx):
|
||||||
try:
|
try:
|
||||||
await ctx.send('🔗 https://discordapp.com/oauth2/authorize?&client_id=' + str(config['client_id']) + '&scope=bot&permissions=' + str(config['permissions']))
|
await ctx.send('🔗 https://discordapp.com/oauth2/authorize?&client_id=' + str(config['client_id']) + '&scope=bot&permissions=' + str(config['permissions']))
|
||||||
except Exception:
|
except Exception:
|
||||||
await ctx.send(exc.base)
|
await ctx.send(exc.base + '\n```python' + traceback.format_exc(limit=1) + '```')
|
||||||
traceback.print_exc(limit=1)
|
traceback.print_exc(limit=1)
|
||||||
|
|
||||||
@bot.command(brief='[IN TESTING]', description='[IN TESTING]', hidden=True)
|
@bot.command(brief='[IN TESTING]', description='[IN TESTING]', hidden=True)
|
||||||
|
@ -72,7 +84,7 @@ async def hi(ctx):
|
||||||
hello = hello[:7] + '**Mod** ' + hello[7:]
|
hello = hello[:7] + '**Mod** ' + hello[7:]
|
||||||
await ctx.send(hello)
|
await ctx.send(hello)
|
||||||
except Exception:
|
except Exception:
|
||||||
await ctx.send(exc.base)
|
await ctx.send(exc.base + '\n```python' + traceback.format_exc(limit=1) + '```')
|
||||||
traceback.print_exc(limit=1)
|
traceback.print_exc(limit=1)
|
||||||
|
|
||||||
@bot.command(hidden=True)
|
@bot.command(hidden=True)
|
||||||
|
|
Loading…
Reference in a new issue