0
0

More than 3 years have passed since last update.

discord.pyで設定機能を追加する(制限あり)

Posted at

※このコードでは再起動するとデータが初期化されるので注意。

@bot.command()
async def config(ctx, config_name, config_arg):
    # /sayaka 設定の名前、数値の順
    if config_name == 'langage':
        #名前がlangageの時
        if config_arg == 'ja':
            set_langage = 'ja'
            config_output = '言語を日本語に設定しました'
        elif config_arg == 'en':
            set_langage = 'en'
            config_output = '言語を英語に設定しました'
        else:
            config_output = '構文エラー。jpまたはenを指定してください。'

    await ctx.send(config_output)

この設定を使うにはifで指定してやればおk。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0