Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
148 views
in Technique[技术] by (71.8m points)

python - To change name of a discord voicechannel

I am trying to change the name of my discord server but I am unsure how to perform such action.

Here is my full code so far:

import discord
import os
from dotenv import load_dotenv
from discord.ext import commands
import asyncio
from string import digits, ascii_letters

load_dotenv()
DISCORD_TOKEN = os.getenv("DISCORD_TOKEN")
bot = commands.Bot(command_prefix="$")


@bot.event
async def on_ready():
    print("It's ready")


@bot.command()
async def change(ctx):
    channel = 203487901092817113
    ctx.message.channel.edit(name="hello")


bot.run(DISCORD_TOKEN)
question from:https://stackoverflow.com/questions/65894083/to-change-name-of-a-discord-voicechannel

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You need an await keyword.

await ctx.message.channel.edit(name="hello")


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...