【发布时间】:2020-09-03 21:47:25
【问题描述】:
我把这个文件上传到heroku,上传没有任何错误,也成功上线了,但是所有命令都不起作用。
代码是:
import discord
import random
from discord.ext import commands
client = commands.Bot(command_prefix = '.')
@client.event
async def on_ready():
print('Bot is ready.')
@client.command()
async def ping(ctx):
await ctx.send(f'Pong! {round(client.latency * 1000)}ms')
@client.command()
async def bye(ctx):
bye = ['Bye-eth',
'Bye puta',
'See ya later']
await ctx.send(f'{random.choice(bye)}')
@client.command(aliases = ['hoi', 'hola', 'hi', 'hey', 'bonjour'])
async def hello(ctx):
hey = ['hola puta',
'hello friend',
"how ya doin'",
"What's up",
"Heyy",
'Helo']
await ctx.send(f'{random.choice(hey)}\nhttps://tenor.com/view/hello-gif-9499692')
@client.command()
async def say(ctx, *, string):
await ctx.channel.purge(limit = 1)
await ctx.send(string)
@client.command(aliases = ['8ball'])
async def _8ball(ctx, *, question):
responses = ['It is certain.',
'It is decidedly so.',
'Without a doubt.',
'Yes – definitely',
'You may rely on it.',
'As I see it, yes.',
'Most likely.',
'Outlook good.',
'Yes.',
'Signs point to yes.' ,
'Reply hazy, try again.',
'Ask again later.',
'Better not tell you now.',
'Cannot predict now.',
'Concentrate and ask again.',
"Don't count on it.",
'My reply is no.',
'My sources say no.',
'Outlook not so good.',
'Very doubtful.']
await ctx.send(f'Question: {question}\nAnswer: {random.choice(responses)}')
@client.command()
async def thank(ctx, *, member):
await ctx.send(f'thank you {member} :grin:')
@client.command()
async def welcome(ctx, *, member):
await ctx.send(f'ur welcome {member} :grin:')
@client.command()
async def kill(ctx, *, member):
await ctx.send(f'oof {member} has been killed :gun:')
client.run('NzExNTQwNzI5OTM1Mjk4NTcw.XsEgTw.HiEuDqPZjsCOxgk3dajkQZcc1Bg')
Procfile 是:worker python puta.py
要求是:discord.py==0.16.12
我认为我也需要在需求列表中添加随机但我不知道如何编写它...我尝试将其写为 random 但它给出了一个错误。
有人可以帮我解决这个问题吗?任何帮助将不胜感激:)
【问题讨论】:
标签: python heroku discord.py