前提
discord.pyでF-BOXというBOTを作っています。
そのBOTにランダムにGIFを送信させるコマンドを作りたいです。
実現したいこと
- BOTにランダムにGIFを送信させるコマンドを作りたい
コード
py
1追記:途中のソースコード 2apikey = "伏せます" 3ckey F-BOX GIFGIF" 4lmt = 1 5r = requests.get("https://tenor.googleapis.com/v2/featured?key=%s&client_key=%s&limit=%s" % (apikey, ckey, lmt)) 6r = requests.get("https://tenor.googleapis.com/v2/categories?key=%s&client_key=%s" % (apikey, ckey)) 7if r.status_code == 200: 8featured_gifs = json.loads(r.content) 9else: 10featured_gifs = None 11 12 13 14if r.status_code == 200: 15categories = json.loads(r.content) 16else: 17categories = None 18gif = random.choice(data["results"])
追記:途中のソースコード
apikey = "伏せます"
ckey F-BOX GIFGIF"
lmt = 1
r = requests.get("https://tenor.googleapis.com/v2/featured?key=%s&client_key=%s&limit=%s" % (apikey, ckey, lmt))
r = requests.get("https://tenor.googleapis.com/v2/categories?key=%s&client_key=%s" % (apikey, ckey))
if r.status_code == 200:
featured_gifs = json.loads(r.content)
else:
featured_gifs = None
if r.status_code == 200:
categories = json.loads(r.content)
else:
categories = None
gif = random.choice(data["results"])
質問文の方に載せてください
編集できます
y_wawaiさん
載せました