0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

ポケモンカードをあいまい検索するDiscordのBotをつくった

0
Posted at

MTGのカードをあいまい検索するDiscordのBotをつくったの応用で、ポケモンカードを適当に検索してくれるBotを作りました。

リーリエ.png

リーリエです。

かわいい.png

ミュウはかわいいですね。

強い.png

強そう。

上級者向け.png

どういう意味かはわからないですがアブソルは上級者向けだそうです。

ケモナー大歓喜.png

ケモナーはカイリューのメガシンカで歓喜したのか。

使い方

DiscordBotの用意

  1. Discordにログインし、https://discord.com/developers/applications にアクセスします

  2. 新しいアプリケーションをクリック、名前をつけて新規作成します
    d1.png

  3. 左側の「概要」から「Bot」を選択、「トークンをリセット」を選択して、トークンをリセットしたのち新しく生成されたトークンをコピーします。メモしておいてください
    d2.png

  4. 下の方に移動し、Message Content Intent の項目をオンにします
    d3.png

5.保存します。

ソースコードの用意

Github(https://github.com/sakots/pokemon_card_img_searcher)からクローンしてディレクトリに移動します。

git clone git@github.com:sakots/pokemon_card_img_searcher.git
cd pokemon_card_img_searcher

インストールしていない場合uvをインストールします。

linuxやmacの場合

curl -LsSf https://astral.sh/uv/install.sh | sh

windowsの場合

powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"

必要なライブラリをインストールします。

uv add discord.py bs4 urllib3 python-dotenv requests

.envというファイルを作成し、以下のように入力し保存します。

TOKEN=(ここにさっきメモしたDiscordのBotトークンを入れる)

以下で起動します。

uv run python bing.py

yahoo検索版。bing版のほうが大きい画像が出る傾向にあります。

uv run python yahoo.py

終わりに

遊戯王は画像の縦横比を変更したらいけそう。

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?