Tom
Tom

Reputation: 21

discord.py commands not excecuting

I have multiple commands but none of thme seem to work, I had all of them in an on_message event, which I thought to be the prolem so I moved it all into seperate commands. There are no errors.

import discord
from googleapiclient.discovery import build
from discord.ext import commands
from PIL import Image, ImageFont, ImageDraw
import requests
import json
import textwrap
import random

yt_api_key = ''

youtube = build("youtube", 'v3', developerKey=yt_api_key)
description = '''blank'''

intents = discord.Intents.default()
client = discord.Client()
bot = commands.Bot(command_prefix='$', description=description, intents=intents)


@client.event
async def on_ready():
    print('We have logged in as {0.user}'.format(client))

@bot.command()
async def test(ctx):
    await ctx.send('test')

Thanks in advance!

Upvotes: 0

Views: 76

Answers (1)

Tom
Tom

Reputation: 21

I found the problem! I'm going to leave this here for anyone else with the same problem. All I did was remove the bot variable and made it into the client one. I think that the two were overlapping eachother.

import discord
from googleapiclient.discovery import build
from discord.ext import commands
from PIL import Image, ImageFont, ImageDraw
import requests
import json
import textwrap
import random

yt_api_key = ''

youtube = build("youtube", 'v3', developerKey=yt_api_key)
description = '''blank'''

intents = discord.Intents.default()

#-----------changed this---------------
client = commands.Bot(command_prefix='$')
#--------------------------------------


@client.event
async def on_ready():
    print('We have logged in as {0.user}'.format(client))
#-------------and this----------------
@client.command()
#--------------------------------------
async def test(ctx):
    await ctx.send('test')

Upvotes: 2

Related Questions