From 68b32fc287517895735f292c906640f22e78c302 Mon Sep 17 00:00:00 2001 From: loicbersier Date: Mon, 27 Apr 2020 17:03:36 +0200 Subject: [PATCH 1/2] Make it work in dm too --- commands/general/tweet.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/commands/general/tweet.js b/commands/general/tweet.js index ad508d93..3d55d344 100644 --- a/commands/general/tweet.js +++ b/commands/general/tweet.js @@ -172,9 +172,10 @@ class tweetCommand extends Command { .addField('Link', `https://twitter.com/i/status/${tweetid}`, true) .addField('Tweet ID', tweetid, true) .addField('Author', `${message.author.username} (${message.author.id})`, true) - .addField('Guild', `${message.guild.name} (${message.guild.id})`, true) .setTimestamp(); + if (message.guild) Embed.addField('Guild', `${message.guild.name} (${message.guild.id})`, true); + if (Attachment[0]) Embed.setImage(Attachment[0].url); channel = client.channels.resolve(twiChannel); From 0b388b690e75a6fa2d5786ea93f26a7316c0c0d8 Mon Sep 17 00:00:00 2001 From: loicbersier Date: Mon, 27 Apr 2020 17:05:16 +0200 Subject: [PATCH 2/2] Show current commit the bot is on --- commands/utility/about.js | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/commands/utility/about.js b/commands/utility/about.js index 61cf6b0a..6aac362c 100644 --- a/commands/utility/about.js +++ b/commands/utility/about.js @@ -1,5 +1,7 @@ const { Command } = require('discord-akairo'); const donator = require('../../models').donator; +const util = require('util'); +const exec = util.promisify(require('child_process').exec); class aboutCommand extends Command { constructor() { @@ -28,18 +30,22 @@ class aboutCommand extends Command { description += 'No one :('; } + exec('git rev-parse --short HEAD') + .then(out => { + console.log(out); + const aboutEmbed = this.client.util.embed() + .setColor(message.member ? message.member.displayHexColor : 'NAVY') + .setAuthor(this.client.user.username, this.client.user.avatarURL()) + .setTitle('About me') + .setDescription(description) + .addField('Current commit', out.stdout) + .addField('Current owner: ', `${this.client.users.resolve(this.client.ownerID).username}#${this.client.users.resolve(this.client.ownerID).discriminator} (${this.client.ownerID})`) + .addField('Gitlab', 'https://gitlab.com/LoicBersier/DiscordBot', true) + .addField('Github', 'https://github.com/loicbersier/Haha-yes', true) + .setFooter(`Original bot made by ${this.client.users.resolve('267065637183029248').username}#${this.client.users.resolve('267065637183029248').discriminator} (267065637183029248)`); // Please don't change the "original bot made by" - const aboutEmbed = this.client.util.embed() - .setColor(message.member ? message.member.displayHexColor : 'NAVY') - .setAuthor(this.client.user.username, this.client.user.avatarURL()) - .setTitle('About me') - .setDescription(description) - .addField('Current owner: ', `${this.client.users.resolve(this.client.ownerID).username}#${this.client.users.resolve(this.client.ownerID).discriminator} (${this.client.ownerID})`) - .addField('Gitlab', 'https://gitlab.com/LoicBersier/DiscordBot', true) - .addField('Github', 'https://github.com/loicbersier/Haha-yes', true) - .setFooter(`Original bot made by ${this.client.users.resolve('267065637183029248').username}#${this.client.users.resolve('267065637183029248').discriminator} (267065637183029248)`); // Please don't change the "original bot made by" - - message.channel.send(aboutEmbed); + message.channel.send(aboutEmbed); + }); } }