【发布时间】:2021-02-02 15:41:52
【问题描述】:
这是代码
import discord
import random
from discord.ext import commands, tasks
from discord.utils import get
@client.command()
async def play(ctx):
red_role = discord.utils.get(ctx.message.guild.roles, name="Red")
blue_role = discord.utils.get(ctx.message.guild.roles, name="Blue")
red_boss_role = discord.utils.get(ctx.message.server.roles, name="Red Boss")
blue_boss_role = discord.utils.get(ctx.message.server.roles, name="Blue Boss")
然后私信
for i in red_boss_role_id.members:
await i.send("????" + str(red_agents))
for i in blue_boss_role_id.members:
await i.send("????" + str(blue_agents))
我已经用 ID 尝试过同样的事情,但没有进展 它说错误
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'Message' object has no attribute 'server'
【问题讨论】:
-
您在代码中从哪里发送 dm?这只是其中的一小部分,还是整个代码?
-
好的,我已经编辑过了,抱歉这是我发布的第一个问题。这只是发生错误的代码的一部分
标签: python discord discord.py