23 lines
645 B
Python
23 lines
645 B
Python
import discord
|
|
from discord.ext import tasks
|
|
from bot import Astro
|
|
import config
|
|
import help
|
|
|
|
client = Astro(command_prefix=config.get_prefix(), intents=discord.Intents.all())
|
|
client.help_command = help.AstroHelp()
|
|
|
|
@client.event
|
|
async def on_voice_state_update(member, before, after):
|
|
if member == client.user:
|
|
return #ignore self actions
|
|
|
|
# get the vc
|
|
voice_client = discord.utils.get(client.voice_clients, guild=member.guild)
|
|
|
|
# if the bot is the only connected member, leave
|
|
if voice_client and len(voice_client.channel.members) == 1:
|
|
await voice_client.disconnect()
|
|
|
|
client.run(config.get_login("live"))
|