亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

Discord.py 分頁

Discord.py 分頁

絕地無雙 2023-08-22 15:22:20
所以我想讓嵌入分頁,這樣它就可以在對表情符號做出反應時改變我找到了一個名為disputils的項目,它使過程變得更容易,但它支持文本,而且無論如何我可以在這段代碼中包含圖片(文檔有沒有示例或說可以嵌入圖片任何幫助將不勝感激):@bot.command()async def paginate(ctx):? ? embeds = [? ? ? ? Embed(title="test page 1", description="This is just some test content!", color=0x115599),? ? ? ? Embed(title="test page 2", description="Nothing interesting here.", color=0x5599ff),? ? ? ? Embed(title="test page 3", description="Why are you still here?", color=0x191638)? ? ]? ? paginator = BotEmbedPaginator(ctx, embeds)? ? await paginator.run()我也嘗試過使用 embed.set_image 但出現錯誤positional argument follows keyword argument (<unknown>, line 12)(它突出顯示了 embed.set_image)
查看完整描述

2 回答

?
慕的地10843

TA貢獻1785條經驗 獲得超8個贊

嘗試使用Embed.set_image單獨的變量,然后將該變量包含在嵌入列表中:


@bot.command()

async def paginate(ctx):

? ? e = Embed(title="test page 1", description="foo", color=0x115599)

? ? e.set_image(url="foo.png")

? ??

? ? embeds = [

? ? ? ? e,

? ? ? ? Embed(title="test page 2", description="bar", color=0x5599ff)

? ? ]


? ? paginator = BotEmbedPaginator(ctx, embeds)

? ? await paginator.run()


查看完整回答
反對 回復 2023-08-22
?
翻翻過去那場雪

TA貢獻2065條經驗 獲得超14個贊

您可以做的一件事是描述列表之外的嵌入。它應該工作得很好,就像它對我來說一樣。我包含了縮略圖和圖像選項,因為我不確定“圖像”是什么意思。


pip install disputils在嘗試將代碼放入文件之前,請確保您已在終端中進行了操作。


這是代碼:


import discord

from disputils import BotEmbedPaginator, BotConfirmation, BotMultipleChoice



bot = commands.Bot(command_prefix='!')


@bot.command()

async def testing(ctx):

    Embed1 = discord.Embed(title="Title", description="Description", color=0x000000)

    Embed1.set_image(url="https://external-preview.redd.it/mu4xWSMFJroZUimyZY4vvjloaAnmzXTh1O2QI_TFlzc.jpg?width=960&crop=smart&auto=webp&s=e042f61d74a80c4bf3f170b9628c14ef56bac427")

    Embed1.set_thumbnail(url="https://external-preview.redd.it/mu4xWSMFJroZUimyZY4vvjloaAnmzXTh1O2QI_TFlzc.jpg?width=960&crop=smart&auto=webp&s=e042f61d74a80c4bf3f170b9628c14ef56bac427")

    Embed2 = discord.Embed(title="Title", description="Description", color=0x000000)

    Embed2.set_image(url="https://external-preview.redd.it/mu4xWSMFJroZUimyZY4vvjloaAnmzXTh1O2QI_TFlzc.jpg?width=960&crop=smart&auto=webp&s=e042f61d74a80c4bf3f170b9628c14ef56bac427")

    Embed2.set_thumbnail(url="https://external-preview.redd.it/mu4xWSMFJroZUimyZY4vvjloaAnmzXTh1O2QI_TFlzc.jpg?width=960&crop=smart&auto=webp&s=e042f61d74a80c4bf3f170b9628c14ef56bac427")

    Embed3 = discord.Embed(title="Title", description="Description", color=0x000000)

    Embed3.set_image(url="https://external-preview.redd.it/mu4xWSMFJroZUimyZY4vvjloaAnmzXTh1O2QI_TFlzc.jpg?width=960&crop=smart&auto=webp&s=e042f61d74a80c4bf3f170b9628c14ef56bac427")

    Embed3.set_thumbnail(url="https://external-preview.redd.it/mu4xWSMFJroZUimyZY4vvjloaAnmzXTh1O2QI_TFlzc.jpg?width=960&crop=smart&auto=webp&s=e042f61d74a80c4bf3f170b9628c14ef56bac427")

    embeds = [Embed1, Embed2, Embed3]

    paginator = BotEmbedPaginator(ctx, embeds)

    await paginator.run()


查看完整回答
反對 回復 2023-08-22
  • 2 回答
  • 0 關注
  • 1633 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號