Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

help.py #4

Open
Sky-seed0215 opened this issue Sep 11, 2022 · 3 comments
Open

help.py #4

Sky-seed0215 opened this issue Sep 11, 2022 · 3 comments
Assignees
Labels
Edit Edit files, docs etc...

Comments

@Sky-seed0215
Copy link
Collaborator

No description provided.

@Sky-seed0215 Sky-seed0215 self-assigned this Sep 11, 2022
@Sky-seed0215 Sky-seed0215 moved this from Edit Files to In Progress in CinnamonBot for D.py Sep 11, 2022
@Sky-seed0215
Copy link
Collaborator Author

help.pyの換装


  • インタラクションの混在防止のためtimeoutを追加
  • disable属性を消去し、Viewを変更した後も別のViewに遷移できるように変更
    • 改善については要検討

@Sky-seed0215
Copy link
Collaborator Author

Sky-seed0215 commented Sep 11, 2022

対象コミット


@nikawamikan
Copy link
Member

class CommandList(Select):
    def __init__(self):
        options = []
        options.append(SelectOption(label="メインコマンド", emoji="📰", description="メインコマンドです。たくさんのコマンド(ほぼネタ)があります。"))
# 中略
    async def callback(self, interaction: Interaction):
        embed = discord.Embed(title=f"helpコマンド:{self.values[0]}",color=0x1e90ff)
        if self.values[0] == "メインコマンド":

この部分のSelectOptionのlabelの文字列とifで使われてる文字列が別生成されてるので単純に打ち間違いリスクありそう
あと単純にif文で書いているのは冗長なので変えたい感じですね
Embedも静的な値で変更がなく毎回インスタンス生成する必要ないので固定値のEmbedを定義しておいてそれを引っ張ってくるなどに変えたほうが良い気がします

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Edit Edit files, docs etc...
Projects
Status: In Progress
Development

No branches or pull requests

2 participants