
投票ステータスを確認
ユーザーがサーバーに投票できるかどうかを確認
エンドポイント
GET
/v1/votes/server/:serverToken/:ipAddressパラメータ
serverTokenstringYour server's unique identifier
ipAddressstringThe user's IP address (e.g., 192.168.1.1)
レスポンス例
Can Vote
{
"can_vote": true,
"seconds_until_next_vote": 0
}Cannot Vote Yet
{
"can_vote": false,
"seconds_until_next_vote": 86400
}コード例
async function checkVoteStatus(serverToken, userIp) {
const url = `https://api.server-hytale.com/v1/votes/server/${serverToken}/${userIp}`;
const res = await fetch(url);
const { can_vote, seconds_until_next_vote } = await res.json();
if (can_vote) {
console.log('User can vote now!');
} else {
console.log(`User can vote in ${seconds_until_next_vote}s`);
}
}ヘルプが必要ですか?
APIをアプリケーションに統合する際のサポートを得るために、Discordコミュニティに参加してください。