Answers for "voice channel discord.py"

8

python discord bot join voice channel

@bot.command()
async def join(ctx):
    channel = ctx.author.voice.channel
    await channel.connect()
@bot.command()
async def leave(ctx):
    await ctx.voice_client.disconnect()
Posted by: Guest on June-08-2020
4

on message discord py

@bot.event
async def on_message(message):
    if message.content == "pong":
        await message.channel.send('ping')
Posted by: Guest on January-12-2021
0

how to leave voice channel discord py

import discord
import pytz
from discord.ext import commands
from datetime import datetime


@bot.command(aliases=['left',  'l'])
async def leave(ctx):
    await ctx.message.delete()
    try:
        if ctx.author.voice.channel and ctx.author.voice.channel == ctx.voice_client.channel:
            await ctx.voice_client.disconnect()
    except AttributeError:
        cfbot=discord.Embed(title='404 ,Not Found', description='The system did not find bot in your channel.nBot may still be in the Channel, but somewhere!', color=0xFFFF00)
        cfbot.timestamp=datetime.now(pytz.timezone('Asia/Bangkok'))
        await ctx.send(embed=cfbot ,delete_after=7.5)
Posted by: Guest on July-29-2021

Code answers related to "voice channel discord.py"

Python Answers by Framework

Browse Popular Code Answers by Language