Как исправить команды, не работающие с Discord Bot, размещенные через Heroku - PullRequest
0 голосов
/ 12 мая 2019

У меня есть бот, размещенный с помощью Heroku через GitHub. Он в сети, но ни одна из команд не работает.

Понятия не имею, что делать, я не очень разбираюсь в этом хостинге. Динамо находится в сети, а токен находится в переменной config. Ниже приведены Requirements.txt и bot.py.

import discord
from discord.ext import commands
from discord.ext.commands import Bot
from discord.ext.commands import has_any_role
from discord.ext.commands import CheckFailure
import asyncio
import random
import requests
import os

client = commands.Bot(command_prefix="-")
client.remove_command("help")

@client.command(pass_context=True)
@has_any_role("Postal Manager", "Board of Directors", "Chief Executive Officer")
async def giverole(ctx, member: discord.Member, *, role: discord.Role):
    user = ctx.message.author
    await client.add_roles(member, role)
    await client.say(f"The role '{role}' has been given to {member.mention} by {user.mention}.")

@giverole.error
async def giverole_error(error, ctx):
    if isinstance(error, CheckFailure):
        await client.say("Error: Do not have sufficient roles for command.")

@client.command(pass_context=True)
@has_any_role("Postal Manager", "Board of Directors", "Chief Executive Officer")
async def removerole(ctx, member: discord.Member, *, role: discord.Role):
    user = ctx.message.author
    await client.remove_roles(member, role)
    await client.say(f"The role '{role}' has been removed from {member.mention} by {user.mention}.")

@removerole.error
async def removerole_error(error,ctx):
    if isinstance(error, CheckFailure):
        await client.say("Error: Do not have sufficient roles for command.")

@client.command(pass_context=True)
async def allies(ctx):
    author = ctx.message.author
    await client.say(f"__**Allies**__ {author.mention} \n \n Our current allies are: \n \n• **DHL** \n \n    DHL is a company that ensures a safe and reliable delivery service. \n\n    **Contract:** https://docs.google.com/document/d/1M7y2dpwnItQ2545DlgWEBH9qJRT_0fN3ePGKFCA4Guw/edit?usp=drivesdk \n \n   **Discord:** https://discord.gg/yTEVtPQ")

@client.event
async def on_ready():
    print("Bot is ready!")

bot_token:client.run(str(os.environ.get('BOT_TOKEN')))
discord
requests
asyncio

Надеюсь, когда я развернусь, бот останется в сети и команды будут работать. Большое спасибо.

...