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()
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()
on message discord py
@bot.event
async def on_message(message):
if message.content == "pong":
await message.channel.send('ping')
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)
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us