Witam mam problem, z botem na Discorda napisanym w Pythonie,a mianowicie chodzi o to, że sam się returnuje, czasem nie minie 5min i się sam wyłącza, z góry dziękuję za pomoc. A tutaj kod bota:
import discord
from discord.ext.commands import Bot
from discord.ext import commands
import asyncio
import pymysql
bot = commands.Bot(command_prefix = "!s")
@bot.event
async def on_ready():
print("Bot zostal uruchomiony")
await bot.change_presence(game=discord.Game(name="sdfdsfsdfsdfds"))
@bot.command(pass_context=True)
async def pr(ctx,user):
db = pymysql.connect(host="sdfsdfsdfl",user="jasdfsdfsdfr",password="Xsdfsdfds9",db="jsdfsdfsdfsdf")
print("Wywolanie komendy !spr z parametrem: {}".format(user))
cursor = db.cursor()
sql = "SELECT * from `punkty` WHERE `nick` = %s"
cursor.execute(sql,(user))
result = cursor.fetchone()
await bot.delete_message(ctx.message)
embed = discord.Embed(title = 'sdfsdf: '+user,discription = '',color = 0x42f456)
embed.add_field(name="sdfsdf: ",value = result[10],inline = False)
embed.add_field(name="sfdfsdfsd",value = result[3],inline = True)
embed.add_field(name="Pusdfdsfds",value = result[4],inline = True)
await bot.say(embed = embed)
db.close()
@bot.command(pass_context=True)
async def trona(ctx):
await bot.delete_message(ctx.message)
await bot.say("dsfdsfsdfsdfsdf")
print("Wywolanie komendy !strona")
@pr.error
async def pr_error(error, ctx):
await bot.delete_message(ctx.message)
emb = discord.Embed(title = '',discription = '',color = 0xd12323)
emb.add_field(name="Błąd!",value = "Wpisz !spr [Nick], lub upewnij się, że taki nick istnieje w bazie!",inline = True)
await bot.say(embed = emb)
print("Wystapil wyjatek komendy: !spr")