diff --git a/.env.example b/.env.example index aa893d0b..4782e544 100644 --- a/.env.example +++ b/.env.example @@ -50,8 +50,7 @@ FACEPLUSPLUS_KEY= FACEPLUSPLUS_SECRET= FLICKR_KEY= GIPHY_KEY= -GITHUB_PASSWORD= -GITHUB_USERNAME= +GITHUB_ACCESS_TOKEN= GOOGLE_CALENDAR_ID= GOOGLE_KEY= GOV_KEY= diff --git a/README.md b/README.md index b6e993fb..f17b858c 100644 --- a/README.md +++ b/README.md @@ -159,6 +159,7 @@ The difficulty in getting all of these keys is why I recommend * `POSTER_TOKEN` is the token of the webhook used for Xiao's meme poster. Not required. * `POSTER_TIME` is the interval to wait between when posting memes using Xiao's meme poster. Not required and defaults to one hour. * `REPORT_CHANNEL_ID` is the ID of the Discord channel you want to send messages from `report` to. Not required, and if not provided the report command simply DMs the owner. +* `JOIN_LEAVE_CHANNEL_ID` is the ID of the Discord channel to send a message to whenever a new server adds or removes the bot. Not required. ### Emoji IDs @@ -170,6 +171,7 @@ simply switch to basic text. * `MOCKING` is used in `mocking`. * `PORTAL` is used in `portal-send`. * `FLANKER`, `FRONT_LINE`, `SUPPORT`, and `DAMAGE` are used in `paladins`. +* `LOADING` is used in commands that need to load for a long time before giving a response, such as `vocodes` and `dec-talk`. ### Dating Info @@ -200,7 +202,7 @@ API. All are free unless otherwise stated. * `FACEPLUSPLUS_KEY` and `FACEPLUSPLUS_SECRET` can be obtained at the [FacePlusPlus console](https://console.faceplusplus.com/). * `FLICKR_KEY` can be obtained by going to [Flickr's App Garden](https://www.flickr.com/services/) and clicking "Get an API Key". * `GIPHY_KEY` can be obtained at the [Giphy developer portal](https://developers.giphy.com/). -* `GITHUB_PASSWORD` and `GITHUB_USERNAME` are exactly what they say they are, all you have to do to get them is [sign up for GitHub](https://github.com/). If you have two-factor auth on your GitHub account, you can use [an access token](https://github.com/settings/tokens) for the password. Even if you don't, this is recommended for privacy reasons. +* `GITHUB_ACCESS_TOKEN` can be obtained by [creating an access token](https://github.com/settings/tokens). * `GOOGLE_CALENDAR_ID` is an email for a Google calendar to be used in the `calendar` command. For example, US Holidays are `en.usa#holiday@​group.v.calendar.google.com`. * `PERSONAL_GOOGLE_CALENDAR_ID` is basically the above, but for extra events. It's named personal as I use my personal email for the events. It's not required, and if not provided will just be skipped. * `GOOGLE_KEY` can be obtained at the [Google Developer Console](https://console.developers.google.com/). Be sure to click "Enable APIs and Services" and enable the following APIs: diff --git a/commands/search/github.js b/commands/search/github.js index 9ab9c5b3..4a3cdc37 100644 --- a/commands/search/github.js +++ b/commands/search/github.js @@ -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/') diff --git a/commands/util-public/changelog.js b/commands/util-public/changelog.js index bc837df7..84110adc 100644 --- a/commands/util-public/changelog.js +++ b/commands/util-public/changelog.js @@ -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`) diff --git a/package.json b/package.json index 0aa4d7c4..01a15685 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xiao", - "version": "119.37.2", + "version": "119.37.3", "description": "Your personal server companion.", "main": "Xiao.js", "scripts": {