我正在制作一个基本的不和谐机器人,它将做的一件事是发送由网站链接组成的消息。 不确定这是否可能,但有没有办法隐藏到原始链接(https://...and等),并只显示链接预览/嵌入? 当我们谈到这个话题的时候,有没有办法可以修改一下embed的外观?比如,我可以更改上面的文本吗(当然,同时保持底层链接不变)? Basically, hide the https://stackoverflow.com/, and say, change the text in the embed to read "Click Me!", while still linking to stack
我制作了超级简单的票证系统,但它不起作用:c。这是我的代码:
@client.event
async def on_reaction_add(reaction, user):
if 'React with to create a ticket' in reaction.message.embeds and reaction.emoji == '':
role = discord.utils.get(user.guild.roles, name="@everyone")
chan = await user.
我正在编辑消息:
chat = client.get_channel(1007301750895677491)
msg = client.fetch_message(1007556250134917170)
await msg.edit(content=discord.File('week_result.png'))
但我错了:
Task exception was never retrieved
future: <Task finished name='Task-14' coro=<week_vipe() done, defined at main
这大部分都很好,但是如何使它只编辑用户发送的最新消息呢?如果有人输入相同的命令两次,然后对第二条消息作出反应,那么只要在60秒窗口中超时,它就会编辑这两条消息。以下是代码:
px = await ctx.send(embed=e)
for name in reactions:
emoji = get(ctx.guild.emojis, name=name)
try: await px.add_reaction(emoji or name)
except: return
d
因此,我做了一个岩石剪刀布命令,它几乎完美地工作。然而,有一个错误,我非常需要修复它。但不幸的是,我无法从任何地方得到任何帮助。下面是代码的工作原理。当你输入'>rps‘时,它会发送一个embed,并要求对任何表情符号(石头、布或剪刀)做出反应。机器人已经选择了它的项目(在随机模块的帮助下)。当我对任何表情符号(石头、布和剪刀表情)做出反应时,它表明我赢了,输了,或者打成了平局。在这里之前一切都很好。但是,当您手动对同一消息做出反应时(使用3种表情符号中的任何一种),消息将再次更改为获胜、失败或抽签嵌入。我希望这种情况在成员完成一场比赛后停止发生。这是我的代码。 my code
@commands.command()
async def spotify(self, ctx, user: discord.Member = None):
if user == None:
user = ctx.author
pass
if user.activities:
for activity in user.activities:
if isinstance(activity, Spotify)== True:
embed = discord.Embed(
我目前正在开发一个机器人,用户可以要求它玩一个游戏,并设置何时玩它:
.play Valorant #30 -> "@anyone_who_is_playing_valorant, up for a round in 30 minutes?"
目前,我每分钟都在编辑消息,以显示正确的剩余时间,不幸的是,这使得实现其他命令和函数变得更加困难(而循环等)。
我唯一的解决办法是显示30分钟的时间:
消息写于17:00 -> "@anyone_who_is_playing_valorant, up for a round at 17:30?"
但是由于时区的
? 这就是我当前嵌入的消息的样子,它真的是杂乱无章的。我如何让我的消息看起来像这样美观和有条理呢? 当前代码 embed = discord.Embed(title="List of webpages you can open",
description="eg: `{open yt`, then it gives you a link to youtube :>")
embed.add_field(name="yt", value="https://www.youtube.co
我一直在考虑在我的不和谐机器人中制作一个21点游戏,但我遇到了一个障碍。
显然,我有一个用命令.blackjack调用的游戏,它在生成随机值和发送消息方面工作得很好。但是,我不知道怎么做,所以玩家能够在发牌的消息发出后说点击或站立,例如。
@client.command()
async def blackjack(ctx):
# (insert all random number gens, etc. here)
await ctx.send(f"{dface1}{dsuit1} ({dvalue1}), {dface2}{dsuit2} ({dvalue2}
import os
import discord
from datetime import datetime, time, timedelta
from discord.ext import commands, tasks
from datetime import datetime, time, timedelta
import asyncio
client = discord.Client()
msg = f"<@{some number}>", 'some number that increases every time the message i
我创建了一个正常工作的“禁用模块”,但是当它加载到一个json文件中时,我得到了一个错误消息。 @client.command(aliases=["disable economy"])
async def disable_economy(message):
with open('disable economy.json', 'r+') as f:
channel = json.load(f)
if not f'{message.channel.id}' in channel:
我使用on_message_delete事件记录已删除的不和谐消息,如下所示:
@commands.Cog.listener()
async def on_message_delete(self, message):
if not message.author.bot:
channel = db.field("SELECT LogID FROM guilds WHERE GuildID = ?", message.guild.id)
if channel != 0: #If this guild want