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?

Make it a Quote画像を生成するAPIと使用方法

Posted at

こんにちは、りょうです。
今回はMake it a Quote画像の生成APIと使用方法の紹介です。

Make it a Quoteとはなんぞや

こんなかんじの画像作れるやつです(語彙力)
image.png

API

僕はこれを使ったDiscordBOTのコンテキストメニューを実装しました。
こいつ使います↓

こうなってるのでそれぞれ対応するのを入れてリクエスト送ります。
今回はリクエストにaxios使ってます

image.png

miq.js
const axios = require('axios');

async function generateImage() {
    const requestData = {
        username: 'ユーザー名',             
        display_name: '表示名', 
        text: 'メッセージ',     
        avatar: 'DiscordのアバターURL', 
        color: false, // falseで白黒、trueでカラーになります                 
    };

    try {
        const response = await axios.post('https://api.voids.top/fakequote', requestData, {
            headers: { 'Content-Type': 'application/json' },
        });

        const imageUrl = response.data.url;
        console.log('生成完了:', imageUrl);
    } catch (error) {
        console.error('生成失敗:', error);
    }
}

generateImage();

成功するとこのように画像URLが返ってきます

image.png

まとめ

これは公式のじゃないので若干本家と違う部分はありますがこれを活用してDiscordBOTにMake it a Quoteの機能を実装することができるので使ってみてください。

わからないことあったら書いてくれれば答えていきます。

Discordにいる荒らしの情報や対策方法の共有をしている自鯖です
ぜひ参加お願いします↓↓↓↓

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?