oauth-discord
v1.5.2
Published
simple discord oauth tool
Downloads
30
Maintainers
Readme
oauth-discord
simple discord oauth tool
Install
$ npm i oauth-discord
$ yarn add oauth-discord
requirements
node.js version 12.0.0 or later
example
Access Token
const DiscordOauth = require('oauth-discord');
const oauth = new DiscordOauth({
version: "v8(option)",
client_id: 'your client id',
client_secret: 'your client secret',
redirect_uri: 'http://localhost:3000/callback',
});
// Using oauth code to get access token
oauth.getToken({
grant_type: 'authorization_code',
code: code,
});
// Using refresh token to get access token
oauth.getToken({
grant_type: 'refresh_token',
refresh_token: refresh_token,
})
Bot api
const DiscordOauth = require('oauth-discord');
const Bot = new DiscordOauth.Bot({
version: "v8(option)",
token: "your bot token",
});
// Search guild member
Bot.searchGuildMember('guild id', 'search query', search_result_limit)
.then(result => {
console.log(result);
})