mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-07 14:55:40 +02:00
Update env vars
This commit is contained in:
@@ -2,7 +2,7 @@ const { Command } = require('discord.js-commando');
|
||||
const { MessageEmbed } = require('discord.js');
|
||||
const snekfetch = require('snekfetch');
|
||||
const { shorten } = require('../../util/Util');
|
||||
const { GITHUB_LOGIN } = process.env;
|
||||
const { GITHUB_USERNAME, GITHUB_PASSWORD } = process.env;
|
||||
|
||||
module.exports = class GitHubCommand extends Command {
|
||||
constructor(client) {
|
||||
@@ -32,7 +32,8 @@ module.exports = class GitHubCommand extends Command {
|
||||
|
||||
async run(msg, { author, repository }) {
|
||||
try {
|
||||
const { body } = await snekfetch.get(`https://${GITHUB_LOGIN}@api.github.com/repos/${author}/${repository}`);
|
||||
const { body } = await snekfetch
|
||||
.get(`https://${GITHUB_USERNAME}:${GITHUB_PASSWORD}@api.github.com/repos/${author}/${repository}`);
|
||||
const embed = new MessageEmbed()
|
||||
.setColor(0xFFFFFF)
|
||||
.setAuthor('GitHub', 'https://i.imgur.com/e4HunUm.png')
|
||||
|
||||
@@ -5,7 +5,7 @@ const { parseString } = require('xml2js');
|
||||
const { promisify } = require('util');
|
||||
const xml = promisify(parseString);
|
||||
const { shorten, cleanXML } = require('../../util/Util');
|
||||
const { MAL_LOGIN } = process.env;
|
||||
const { MAL_USERNAME, MAL_PASSWORD } = process.env;
|
||||
|
||||
module.exports = class MyAnimeListAnimeCommand extends Command {
|
||||
constructor(client) {
|
||||
@@ -29,7 +29,7 @@ module.exports = class MyAnimeListAnimeCommand extends Command {
|
||||
async run(msg, { query }) {
|
||||
try {
|
||||
const { text } = await snekfetch
|
||||
.get(`https://${MAL_LOGIN}@myanimelist.net/api/anime/search.xml`)
|
||||
.get(`https://${MAL_USERNAME}:${MAL_PASSWORD}@myanimelist.net/api/anime/search.xml`)
|
||||
.query({ q: query });
|
||||
const body = await xml(text);
|
||||
const data = body.anime.entry[0];
|
||||
|
||||
@@ -5,7 +5,7 @@ const { parseString } = require('xml2js');
|
||||
const { promisify } = require('util');
|
||||
const xml = promisify(parseString);
|
||||
const { shorten, cleanXML } = require('../../util/Util');
|
||||
const { MAL_LOGIN } = process.env;
|
||||
const { MAL_USERNAME, MAL_PASSWORD } = process.env;
|
||||
|
||||
module.exports = class MyAnimeListMangaCommand extends Command {
|
||||
constructor(client) {
|
||||
@@ -29,7 +29,7 @@ module.exports = class MyAnimeListMangaCommand extends Command {
|
||||
async run(msg, { query }) {
|
||||
try {
|
||||
const { text } = await snekfetch
|
||||
.get(`https://${MAL_LOGIN}@myanimelist.net/api/manga/search.xml`)
|
||||
.get(`https://${MAL_USERNAME}:${MAL_PASSWORD}@myanimelist.net/api/manga/search.xml`)
|
||||
.query({ q: query });
|
||||
const body = await xml(text);
|
||||
const data = body.manga.entry[0];
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
const { Command } = require('discord.js-commando');
|
||||
const snekfetch = require('snekfetch');
|
||||
const { WEBHOOK_URL } = process.env;
|
||||
const { WEBHOOK_ID, WEBHOOK_TOKEN } = process.env;
|
||||
|
||||
module.exports = class WebhookCommand extends Command {
|
||||
constructor(client) {
|
||||
@@ -15,7 +15,7 @@ module.exports = class WebhookCommand extends Command {
|
||||
clientPermissions: ['MANAGE_MESSAGES'],
|
||||
args: [
|
||||
{
|
||||
key: 'message',
|
||||
key: 'content',
|
||||
prompt: 'What text would you like the webhook to say?',
|
||||
type: 'string'
|
||||
}
|
||||
@@ -23,10 +23,10 @@ module.exports = class WebhookCommand extends Command {
|
||||
});
|
||||
}
|
||||
|
||||
async run(msg, { message }) {
|
||||
async run(msg, { content }) {
|
||||
if (msg.channel.type === 'text') await msg.delete();
|
||||
try {
|
||||
await snekfetch.post(WEBHOOK_URL).send({ content: message });
|
||||
await snekfetch.post(`https://discordapp.com/api/webhooks/${WEBHOOK_ID}/${WEBHOOK_TOKEN}`).send({ content });
|
||||
return null;
|
||||
} catch (err) {
|
||||
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
||||
|
||||
Reference in New Issue
Block a user