I have a bot hosted using Heroku, through GitHub. It is online but none of the commands work.

I have no clue what to do, I am not very experienced at this bot hosting thing. The dyno is online and token is in a config variable. Below are requirements.txt and 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

Hopefully, when I deploy, the bot will stay online and the commands will work. Many thanks.

0 Answers