diff --git a/python/discord.py/example-bot.py b/python/discord.py/example-bot.py index f71ca16..54787b4 100644 --- a/python/discord.py/example-bot.py +++ b/python/discord.py/example-bot.py @@ -1,5 +1,5 @@ # This is an example of a very basic discord bot in python -import discord +import discord, os, sys from discord.ext import commands @@ -24,5 +24,12 @@ async def _ping(ctx): bot.add_command(_ping) +@commands.command(name="restart") +async def _restart(ctx): + await ctx.send("Restarting...") + os.execv(sys.executable, ['python'] + sys.argv) + +bot.add_command(_restart) + if __name__ == "__main__": # make sure the file isn't being imported bot.run("YOUR_TOKEN_HERE") # put your own bot token in here