【发布时间】:2019-01-21 03:50:04
【问题描述】:
如果机器人随时崩溃,如何让我的机器人永远运行。
我在 linux 服务器上使用putty 在screen 中运行这个 main.py 文件,但我需要运行另一个文件来检查这个 main.py 文件是否每 30 分钟运行一次,如果没有它应该重新启动 main.py 文件。
所以下面是我的 main.py
import discord
from discord.ext import commands
from discord.ext.commands import Bot
bot = commands.Bot(command_prefix='!')
@bot.event
async def on_ready():
print (bot.user.name)
print (bot.user.id)
print ("_____")
@bot.command(pass_context=True)
async def first(ctx):
await bot.say("Hello {}".format(ctx.message.author.mention))
bot.run("XXXXXXXXXXXXXXXXXXXXXXXXXXXXX")
【问题讨论】:
标签: python-3.x discord.py