Change Github Authorization

This commit is contained in:
Dragon Fire
2020-11-02 12:05:43 -05:00
parent a810bd793c
commit f77adabb35
5 changed files with 11 additions and 10 deletions
+3 -3
View File
@@ -2,8 +2,8 @@ const Command = require('../../structures/Command');
const moment = require('moment');
const { MessageEmbed } = require('discord.js');
const request = require('node-superfetch');
const { shorten, formatNumber, base64 } = require('../../util/Util');
const { GITHUB_USERNAME, GITHUB_PASSWORD } = process.env;
const { shorten, formatNumber } = require('../../util/Util');
const { GITHUB_ACCESS_TOKEN } = process.env;
module.exports = class GithubCommand extends Command {
constructor(client) {
@@ -43,7 +43,7 @@ module.exports = class GithubCommand extends Command {
try {
const { body } = await request
.get(`https://api.github.com/repos/${author}/${repository}`)
.set({ Authorization: `Basic ${base64(`${GITHUB_USERNAME}:${GITHUB_PASSWORD}`)}` });
.set({ Authorization: `token ${GITHUB_ACCESS_TOKEN}` });
const embed = new MessageEmbed()
.setColor(0xFFFFFF)
.setAuthor('GitHub', 'https://i.imgur.com/e4HunUm.png', 'https://github.com/')
+3 -3
View File
@@ -1,8 +1,8 @@
const Command = require('../../structures/Command');
const { MessageEmbed } = require('discord.js');
const request = require('node-superfetch');
const { shorten, base64, embedURL } = require('../../util/Util');
const { GITHUB_USERNAME, GITHUB_PASSWORD, XIAO_GITHUB_REPO_USERNAME, XIAO_GITHUB_REPO_NAME } = process.env;
const { shorten, embedURL } = require('../../util/Util');
const { GITHUB_ACCESS_TOKEN, XIAO_GITHUB_REPO_USERNAME, XIAO_GITHUB_REPO_NAME } = process.env;
module.exports = class ChangelogCommand extends Command {
constructor(client) {
@@ -27,7 +27,7 @@ module.exports = class ChangelogCommand extends Command {
async run(msg) {
const { body } = await request
.get(`https://api.github.com/repos/${XIAO_GITHUB_REPO_USERNAME}/${XIAO_GITHUB_REPO_NAME}/commits`)
.set({ Authorization: `Basic ${base64(`${GITHUB_USERNAME}:${GITHUB_PASSWORD}`)}` });
.set({ Authorization: `token ${GITHUB_ACCESS_TOKEN}` });
const commits = body.slice(0, 10);
const embed = new MessageEmbed()
.setTitle(`[${XIAO_GITHUB_REPO_NAME}:master] Latest 10 commits`)