Бот проверки Discord x roblox не работает - PullRequest
0 голосов
/ 08 июля 2020

Я пытаюсь создать бота проверки roblox на Discord, но он всегда говорит, что он не проверен. Я использую запрос для получения данных:

    const Discord = require("discord.js");
    const request = require("request-promise");
    const rolename = "EC | Economy Class";
    let verifiedrole = call.message.guild.roles.cache.find(role => role.name === `${rolename}`);
    let userid = call.message.author.id;

    let wow = `https://verify.eryn.io/api/user/${userid}`;
    let responce = request(wow, {json: true});


    if(responce.status == "ok")
    {
        const embed = new Discord.MessageEmbed()
        .setTitle("SeaLink Verification")
        .setDescription("You have been verified sucessfully under user: **" + responce.robloxUsername + "**.")

        .setColor("#1f75ff")
        .setFooter("SeaLink V2 | Dizzy Tech");
        call.message.channel.send(embed);
    }
    else
    {
        const embed = new Discord.MessageEmbed()
        .setTitle("SeaLink Verification")
        .setDescription("Your not linked with our API! please visit [this](https://discord.com/oauth2/authorize?client_id=240413107850182656&scope=identify+guilds&response_type=code&redirect_uri=https%3A%2F%2Fverify.eryn.io) website to link yourself and then try again.")

        .setColor("#1f75ff")
        .setFooter("SeaLink V2 | Dizzy Tech");
        call.message.channel.send(embed);
    }

    console.log(request + "\n\n\n\n\n" + wow);
}

1 Ответ

0 голосов
/ 09 июля 2020
const fetch = require("node-fetch");

fetch(`https://verify.eryn.io/api/user/${message.author.id}`).then(response => response.json()).then(response => { // Fetching the API and transforming the response into JSON if not already.
    if (response.status == "ok") { // Checking if the request's status is okay
        const embed = new discord.MessageEmbed()
        .setTitle("SeaLink Verification")
        .setDescription("You have been verified sucessfully under user: **" + response.robloxUsername + "**.")

        .setColor("#1f75ff")
        .setFooter("SeaLink V2 | Dizzy Tech");
        message.channel.send(embed)
    } else {
        const embed = new discord.MessageEmbed()
        .setTitle("SeaLink Verification")
        .setDescription("Your not linked with our API! please visit [this](https://discord.com/oauth2/authorize?client_id=240413107850182656&scope=identify+guilds&response_type=code&redirect_uri=https%3A%2F%2Fverify.eryn.io) website to link yourself and then try again.")

        .setColor("#1f75ff")
        .setFooter("SeaLink V2 | Dizzy Tech");
        message.channel.send(embed);
    }
});
...