Skip to content

grampr/easy-bdc_bettercommand

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

Better Command プラグイン v1.0

引数・説明・app_commands.Choice に対応したスラッシュコマンドブロックを追加します。


ブロック一覧

コマンド定義

ブロック 説明
⚡ スラッシュコマンド / name 説明 desc 引数付きスラッシュコマンドを定義

引数の種類(▼引数 の中に並べる)

ブロック Python 型
📝 文字列引数 str
🔢 整数引数 int
☑ 真偽値引数 bool
👤 メンバー引数 discord.Member
💬 テキストch引数 discord.TextChannel
🎙 VCチャンネル引数 discord.VoiceChannel
🔽 選択肢引数 app_commands.Choice[str/int]

各引数ブロックに / 説明 / 必須(チェックボックス) を設定できます。

選択肢

  • 🔽 選択肢引数 の「選択肢 ↓」欄に ・ 選択肢アイテム を並べる

値の取得(実行する処理 内で使う)

ブロック 返す値
引数 XXX の値 str / int / bool / Member / Channel
選択肢引数 XXX の値 .value(文字列 or 整数)

生成されるコード例

@bot.tree.command(name="vc", description="VCに参加します")
@app_commands.describe(channel="読み上げるテキストチャンネル")
async def vc_cmd(interaction: discord.Interaction, channel: discord.TextChannel):
    ctx = interaction
    user = interaction.user
    # 処理...
@bot.tree.command(name="color", description="色を選ぶ")
@app_commands.describe(color="好きな色")
@app_commands.choices(color=[app_commands.Choice(name="赤", value="red"), app_commands.Choice(name="青", value="blue")])
async def color_cmd(interaction: discord.Interaction, color: app_commands.Choice[str]):
    ctx = interaction
    user = interaction.user
    chosen = color.value  # "red" or "blue"

About

コマンドを強化するブロックを追加しました。

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors