Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion python/discord.py/example-bot.py
Original file line number Diff line number Diff line change
@@ -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


Expand All @@ -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