wie erstelle ich ein vc channel in pycord?

1 Antwort

import discord 
from discord.ext import commands 
from discord.ui import Button, View

intents = discord.Intents.default() 
intents.message_content = True

bot = commands.Bot(command_prefix="!", intents=intents)

class CreateChannelButton(Button):
  def __init__(self):
    super().__init__(label="Create Voice Channel", style=discord.ButtonStyle.green)

  async def callback(self, interaction: discord.Interaction):
    guild = interaction.guild
    channel = await guild.create_voice_channel("New Voice Channel")
    await interaction.response.send_message(f"Voice Channel '{channel.name}' created!", ephemeral=True)

@bot.event
async def on_ready():
  print(f"Bot is ready. Logged in as {bot.user}")

@bot.command()
async def create_button(ctx):
    button = CreateChannelButton()
    view = View()
    view.add_item(button)
    await ctx.send("Click the button to create a voice channel:", view=view)

bot.run("YOUR_BOT_TOKEN")
Woher ich das weiß:Recherche