Untitled
unknown
python
a year ago
1.4 kB
7
Indexable
import discord
from discord.ext import commands, tasks
intents = discord.Intents.default()
intents.voice_states = True
bot = commands.Bot(command_prefix="+", intents=discord.Intents.all())
@commands.is_owner()
async def sync(ctx,guild=None):
if guild == None:
await bot.tree.sync()
else:
await bot.tree.sync(guild=discord.Object(id=int(guild)))
await ctx.send("**Sincronizado!**")
@bot.event
async def on_ready():
print(f'Bot connected as {bot.user}')
check_empty_channels.start() # Inicia a tarefa quando o bot está pronto
@bot.command(name="TempCall", help="cria call", aliases=['blabla'])
async def createcall(ctx, *, name="TempCall"):
print("funfou")
guild = ctx.guild
# Create a new voice channel
channel = await guild.create_voice_channel(name)
print(f'Canal Criado {channel.name} with ID {channel.id}')
canalTemporario.append(channel.id)
await ctx.send(f'Canal de voz temporario: {channel.name}')
canalTemporario = []
@tasks.loop(minutes=1)
async def check_empty_channels():
for channel_id in canalTemporario:
channel = bot.get_channel(channel_id)
if channel and len(channel.members) == 0:
await channel.delete()
print(f'Canal deletado {channel.name}')
canalTemporario.remove(channel_id)
# Inclua sua chave de bot real aqui
bot.run("TOKEN DO BOT DE VCS")Editor is loading...
Leave a Comment