Discord PY API 端点更改

问题描述 投票:0回答:0

我想更改机器人的 API 端点,以便它可以为 discord api 的替代实例工作。 现在我会隐藏 url,因为一些我现在不会解释的原因。我只有很少的文档,大麦可以让它发挥作用。

这是我的代码:

#token is in enovirment
import os
#import discord/disocrdpy
import discord

#change the api url
discord.http.Route.BASE = "Discord Alterative URL"

#setup intents
intents = discord.Intents.default()
intents.messages = True


#setup bot token
token = os.environ['token']
#make the client
client = discord.Client(intents=intents)

#tell when the bot has logged in
@client.event
async def on_ready():
    print(f"Logged in as {client.user} (ID: {client.user.id})")

#run the bot with minimal erors
try:
    client.run(token)
except Exception as e:
    print(f"Error: {e}")

我遇到了这些错误

2023-05-03 11:26:46 INFO discord.client logging in using static token
Error: string indices must be integers
python api url discord bots
© www.soinside.com 2019 - 2024. All rights reserved.