英文:
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)
英文:
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 = "855179067388461076>"
ShopEM = discord.Embed(title=f"🢃 BASIC COLORS SHOP 🢃", color=0xff5555)
ShopEM.add_field(name=f"1) Magenta", value=f'<@&' + (roleId), inline=True)
ShopEM.add_field(name=f"2) khaki ", value=f"<@&1075540590604853278>", inline=False)
ShopEM.add_field(name=f"3) Purple", value=f"<@&1075540578072273006>", inline=False)
ShopEM.add_field(name=f"4) Gray", value=f"<@&1075540541195960400>", inline=True)
ShopEM.add_field(name=f"5) Olive ", value=f"@&1075540533457461379>", inline=False)
ShopEM.add_field(name=f"6) Teal", value=f"<@&1075540547021840404>", inline=False)
ShopEM.add_field(name=f"PRICE", value="")
await ctx.send(embed=ShopEM)
答案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设置为整数或字符串都没有关系。例如,在这里和那里都没有问题。
工作示例:
英文:
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 = [
("bots", "1065670055507005128"),
("server booster", "1068466410612867541"),
("human", 1064550904461795018),
("admin", 813738863871787428)
]
shop_em = discord.Embed(title="🢃 BASIC COLORS SHOP 🢃", 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"<@&{role[1]}>", 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:
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论