実現したいこと
プルダウンを使って文字を表示させたい。
前提
ここに質問の内容を詳しく書いてください。
(例)
TypeScriptで●●なシステムを作っています。
■■な機能を実装中に以下のエラーメッセージが発生しました。
発生している問題・エラーメッセージ
optionのvalueが改行を入れても改行されなかったです。
該当のソースコード
discord.py
1import os 2import discord 3from discord import Intents, Client, Interaction 4from discord.ui import Select, View 5from discord.app_commands import CommandTree 6from dotenv import load_dotenv 7 8 9load_dotenv() 10 11 12class MyClient(Client): 13 def __init__(self, intents: Intents) -> None: 14 super().__init__(intents=intents) 15 self.tree = CommandTree(self) 16 17 async def setup_hook(self) -> None: 18 await self.tree.sync() 19 20 async def on_ready(self): 21 print(f"login: {self.user.name} [{self.user.id}]") 22 23 24intents = Intents.all() 25client = MyClient(intents=intents) 26 27 28class SelectView(View): 29 def __init__(self, *, timeout: float = 20): 30 super().__init__(timeout=timeout) 31 32 async def on_timeout(self) -> None: 33 34 print("timeout") 35 @discord.ui.select( 36 cls=Select, 37 placeholder="選択してください。", 38 39 40 ) 41 async def selectMenu(self, interaction: Interaction, select: Select): 42 # await interaction.response.send_message(f"{select.values}") 43 select.disabled = True 44 await interaction.response.edit_message(view=self) 45 await interaction.followup.send(f"{select.values}") 46 47@client.tree.command() 48async def somemenu(interaction: Interaction): 49 # select = Select(placeholder="選択してください") 50 # select.add_option( 51 # label="user can see this", 52 # value="user can not see this", 53 # description="this is description", 54 # ) 55 # view = View() 56 # view.add_item(select) 57 view = SelectView() 58 view.selectMenu.add_option( 59 label="会議の使い方", 60 value="当サーバーは個通会議メインですが、\n会議も開催しているのでよかったらご参加ください!", 61 62 63 ) 64 view.selectMenu.add_option( 65 label="女性について", 66 value="い", 67 68 ) 69 70 71 await interaction.response.send_message("menu", view=view) 72 73 74client.run("トークン") 75
試したこと
value="当サーバーは個通会議メインですが、\n会議も開催しているのでよかったらご参加ください!",
\nを入れても改行されなかった
お手柔らかにお願いします

回答1件
あなたの回答
tips
プレビュー