我想获得discord.py中附加到消息的图像的高度。这是我的代码:
if message.content(discord.Attachment.height > 0):
await message.channel.send('Your media file is restricted!')
运行时,它会给出以下错误:
error: TypeError: '>' not supported between instances of 'member_descriptor' and 'int'
我做了一些研究,发现了一种(可能)用来给某人发短信的老方法。
async def dm(ctx, recipient=None, message=None):
if message == None or recipient == None:
await ctx.channel.send("***Error: Incorrect Usage***\nUsage: `/test [recipient] [message]`")
else:
pass
if message is not None:
if rec
因此,我试图构建一个不和谐的机器人,我想要拥有的功能之一是引用以前的消息并从中提取数据。我已经存储了我想要引用的消息ID,但是我似乎找不到如何从它的ID中提取消息对象。
if split[0] == 'ref':
if (len(split) < 2):
await message.channel.send("!ref,poll or sg,id number")
if (len(split) == 3):
if split[1] == "poll":
for x
该命令可以工作,但当你与自己调情时,它不会显示正确的消息。它只会显示你和别人调情时发送的信息。 @client.command()
async def flirt(ctx, *, user):
flirts = ["I wish I was your mirror, so that I could look at you every morning.",
"When I need a pick me up, I just think of your laugh and it makes me smile.",
"Sweet dr
为了防止新帐户使用某个命令,当用户输入消息时,我如何获得用户帐户(或创建日期)的时间。
client.get_user(account_date)
if account_date < 14:
print('Your account must be older than 14 days to use this command')
else:
print('Your account can use this command')
任何帮助都是非常感谢的。
这是我的代码:
#Ticket
@client.command(pass_context=True)
async def setuppartnership(ctx):
guild = ctx.guild
embed = discord.Embed(
title = 'Richiesta Partnership',
description = 'Vuoi fare partnership? Usa la reazione qui sotto per creare un nuovo ticket.',
我尝试在我的cogs文件中实现嵌入消息。当我尝试使用该命令时,此错误在我的控制台上弹出。 An exception has occurred while executing command `cal`:
Traceback (most recent call last):
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord_slash/client.py", line 1352, in invoke_command
await func.invoke(ctx, **args)
F
这需要上下文,没有它,代码就没有意义。
基本上,我们的服务器上有一个叫做69 chat的聊天。如果没有69条信息,机器人将删除该消息。我想这样做,如果你忘记了69,它会给你的信息,你应该发送(只是消息+ 69)。我试过这个:
@bot.event
async def on_message(message):
await bot.process_commands(message)
if message.channel.id == 757140530739150848:
if '69' in message.content:
return
els
我想知道如何通过消息id获取消息。我尝试过discord.fetch_message(id)和discord.get_message(id),但都提到了:
Command raised an exception: AttributeError: module 'discord' has no attribute 'fetch_message'/'get_message'
if message.author.id != USER ID HERE:
msg = client.get_message(message, message.author)
await client.send_message(message.channel, msg)
我想让机器人复制人们的信息,然后说出来。(只是为了拉几个好朋友。无论如何,)有了这段代码,机器人在他们说什么的时候会回复,但用"“代替了完全相同的消息。
帮帮忙,好吗?