discord.py: invoking command with no context

Viewed 44

I have a listener waiting for someone to join a specific voice channel, when they do I would like it to run another command on the bot. The issue I have is that I cannot invoke another command ctx.invoke(play, arg) because I have no message context.

I am wondering if there is another way of invoking a command or if I could obtain context from elsewhere, as the command being run will function the same regardless of context.

1 Answers

I think you could try the following:

@bot.event
async def on_voice_state_update(member, before, after):
  if not before.channel and after.channel and not member.bot:
    if after.channel.id == [YOUR_CHANNEL_ID]:
    
Related