Discord 整数删除提及 <@Deleted-Role>

huangapple go评论54阅读模式
英文:

Discord Integer delete mention <@Deleted-Role>

问题

I'm wondering if any of you guys can figure out how I could use my role: Name: Color Magenta. Id. 855179067388461076

Known Issue: Discord has a limitation on the maximum integer length. I believe... that's what I know...

@bot.command()
async def Shop(ctx):
    roleId = "855179067388461076"
    ShopEM = discord.Embed(title="🔔 BASIC COLORS SHOP 🔔", color=0xff5555)
    ShopEM.add_field(name="1) Magenta", value=f'<@&{roleId}>', inline=True)
    ShopEM.add_field(name="2) Khaki", value="<@&1075540590604853278>", inline=False)
    ShopEM.add_field(name="3) Purple", value="<@&1075540578072273006>", inline=False)
    ShopEM.add_field(name="4) Gray", value="<@&1075540541195960400>", inline=True)
    ShopEM.add_field(name="5) Olive", value="<@&1075540533457461379>", inline=False)
    ShopEM.add_field(name="6) Teal", value="<@&1075540547021840404>", inline=False)
    ShopEM.add_field(name="PRICE", value="")
    await ctx.send(embed=ShopEM)

Output: Discord 整数删除提及 <@Deleted-Role>

英文:

I'm wondering if any of you guys can figure out how i could use my role : Name : Color Magenta. Id. 855179067388461076

Known Issue: Discord have limitation of integer maximum lenght. I believe.. that's what i know..

 @bot.command()
async def Shop(ctx):
    roleId = &quot;855179067388461076&gt;&quot;
    ShopEM = discord.Embed(title=f&quot;&#129155; BASIC COLORS SHOP &#129155;&quot;, color=0xff5555)
    ShopEM.add_field(name=f&quot;1) Magenta&quot;, value=f&#39;&lt;@&amp;&#39; + (roleId), inline=True)
    ShopEM.add_field(name=f&quot;2) khaki &quot;, value=f&quot;&lt;@&amp;1075540590604853278&gt;&quot;, inline=False)
    ShopEM.add_field(name=f&quot;3) Purple&quot;,  value=f&quot;&lt;@&amp;1075540578072273006&gt;&quot;, inline=False)
    ShopEM.add_field(name=f&quot;4) Gray&quot;, value=f&quot;&lt;@&amp;1075540541195960400&gt;&quot;, inline=True)
    ShopEM.add_field(name=f&quot;5) Olive &quot;, value=f&quot;@&amp;1075540533457461379&gt;&quot;, inline=False)
    ShopEM.add_field(name=f&quot;6) Teal&quot;, value=f&quot;&lt;@&amp;1075540547021840404&gt;&quot;, inline=False)
    ShopEM.add_field(name=f&quot;PRICE&quot;, value=&quot;&quot;)
    await ctx.send(embed=ShopEM)

Output : Discord 整数删除提及 <@Deleted-Role>

答案1

得分: 1

  • 你确定:
    • 机器人是否有提及这些角色的权限?
    • 这些ID是否是该服务器的正确角色?

我的代码如下,与你的非常相似,完全正常运行。只有当我输入虚构的数字或不在此服务器中的角色时,才会得到 deleted-role

@bot.command()
async def shop(ctx):
    # 要迭代的包含角色名和角色ID的元组列表
    roles = [
        ("bots", "1065670055507005128"),
        ("server booster", "1068466410612867541"),
        ("human", 1064550904461795018),
        ("admin", 813738863871787428)
    ]
    shop_em = discord.Embed(title="🛒 基础颜色商店 🛒", color=0xff5555)
    
    # 遍历角色并将它们添加到嵌入中
    for role in roles:
        shop_em.add_field(name=role[0], value=f"<@&{role[1]}>", inline=True)

    await ctx.send(embed=shop_em)

注意:将ID设置为整数或字符串都没有关系。例如,在这里和那里都没有问题。

工作示例:

Discord 整数删除提及 <@Deleted-Role>

英文:

Are you sure:

  • that the bot has permissions to mention those roles?
  • that those IDs are the correct roles for this server?

My code below, very similar to yours, works absolutely fine. I only got deleted-role when I entered in numbers that were made up or for roles not in this server.

@bot.command()
async def shop(ctx):
    # list of tuples to iterate over with the role name and then role ID
    roles = [
        (&quot;bots&quot;, &quot;1065670055507005128&quot;),
        (&quot;server booster&quot;, &quot;1068466410612867541&quot;),
        (&quot;human&quot;, 1064550904461795018),
        (&quot;admin&quot;, 813738863871787428)

    ]
    shop_em = discord.Embed(title=&quot;&#129155; BASIC COLORS SHOP &#129155;&quot;, color=0xff5555)
    
    # iterate over the roles and add them to the embed
    for role in roles:
        shop_em.add_field(name=role[0], value=f&quot;&lt;@&amp;{role[1]}&gt;&quot;, inline=True)

    await ctx.send(embed=shop_em)

Note: Putting the IDs as ints or strings didn't matter at all. For example, I use both here and there weren't issues with either.

Example of it working:

Discord 整数删除提及 <@Deleted-Role>

huangapple
  • 本文由 发表于 2023年2月16日 06:40:11
  • 转载请务必保留本文链接:https://go.coder-hub.com/75466081.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定