下面是我的代码,我用Discord.Py做了一个机器人,它的基础是截图,然后把截图贴到discord上,它应该每5分钟连续重复这个过程。这在我的脚本中有效,然而,在一小段时间后,机器人就会在不和谐中离线,并且不再处于它的角色下,或者在在线成员下,并显示为离线。它们是迫使机器人保持在线的一种方式吗?
import pyautogui
import pyscreeze
import time
import discord
from discord.ext import tasks
from discord.ext.commands import Bot
from discord.ext impor
此代码应返回成员的数量以及他们的在线或离线状态。然而,它只产生了一个在线的成员,其他人都离线了,这不是真的。当我测试它正在考虑哪些成员(print(member))时,结果发现机器人只考虑了它自己。任何帮助告诉我如何让机器人考虑服务器的成员,而不是本身,将不胜感激。 @client.command()
async def stats(ctx):
count=0
for member in ctx.guild.members:
if member.status is not discord.Status.offline:
count
我正在尝试编辑已发送的嵌入消息(用作角色反应消息)。例如:我键入" roles“并获得一个嵌入消息,该消息在响应时分配角色。我想编辑它以在描述中添加另一个角色,而不发送全新的消息。MEE6机器人能够做到这一点,所以我相信这是可能的。我找到了应该可以工作的代码: # This sends an embed message with a description of the roles.
@client.event
async def on_message(message):
if message.channel.id == 700895165665247325:
(node:24) UnhandledPromiseRejectionWarning: TypeError: fields.flat is not a function 有没有人知道如何修复在服务器上托管机器人时出现这个错误,因为错误出现在新用户加入无序服务器时,正常情况下机器人会发送嵌入式dm欢迎消息,但现在它只是给我这个错误,当我在我的pc上启动机器人时,它工作得很好,当我使用非嵌入式版本时,它也在服务器上工作,所以它必须与嵌入消息有关。 顺便说一下,我的整个代码: const Discord = require('discord.js');
const { prefix
import discord
import os
client = discord.Client(intents=discord.Intents.default())
@client.event
async def on_ready():
print("We have logged in as {0.user}".format(client))
@client.event
async def on_message(message):
if message.author == client.user:
return
if message.con
有人能帮我吗?当我试图启动我的不和谐机器人时,我一直收到这个错误消息。
[2022-08-23 14:32:12] [WARNING ] discord.ext.commands.bot: Privileged message content intent is missing, commands may not work as expected.
这是bot的代码,后面是命令和事件以及client.run(My_Token)
import os
import random
import discord
from discord.ext import commands
from discord
我有一个问题,我需要从机器人在线的所有服务器上获得所有成员的列表(我正在使用discord.py重写),现在我有以下代码片段: @bot.command()
async def members(ctx):
for guild in bot.guilds:
for member in guild.members:
print(member) 该程序输出3次Bots名称,因为该机器人位于3个服务器上。 谢谢!
我一直在为我所在的服务器制作一个自定义机器人,直到我在代码中遇到这个运行时错误之前,一切都进行得很顺利。有小费吗?
错误:
throw new DiscordAPIError(data, res.status, request);
^
DiscordAPIError: Invalid Form Body
embeds[0].description: This field is required
at RequestHandler.execute (C:\Users\arinb\node_modules\discord.js\src\rest\RequestHa