From 5cb5da67abf6b7685da13b6fd09e5da2acdbde5b Mon Sep 17 00:00:00 2001 From: Dragon Fire Date: Sat, 30 May 2020 18:23:42 -0400 Subject: [PATCH] Ship and Friendship Owner Replies --- assets/json/xiao-fact.json | 5 +++-- commands/random-seed/friendship.js | 18 +++++++++++++++--- commands/random-seed/ship.js | 17 ++++++++++++++--- package.json | 2 +- 4 files changed, 33 insertions(+), 9 deletions(-) diff --git a/assets/json/xiao-fact.json b/assets/json/xiao-fact.json index eeedebd3..234fd77b 100644 --- a/assets/json/xiao-fact.json +++ b/assets/json/xiao-fact.json @@ -39,7 +39,7 @@ "The `dick` command, when used on Xiao, will give your own size, plus one.", "There are several special timezones in `time`, such as \"Discord\", \"Dragon\", and \"Neopia\".", "The `bro-hoof` and `high-five` commands used to be the same, but users complained about the MLP GIFs, causing them to be split.", - "Xiao used to have several more roleplay commands, such as `cuddle`, `marry`, `divorce`, `falcon-punch`, and `inhale`. These were merged with other commands due to lack of good GIFs.", + "Xiao used to have several more roleplay commands, such as `cuddle`, `marry`, `divorce`, and `falcon-punch`. These were merged with other commands due to lack of good GIFs.", "The `anime` and `manga` commands have used MyAnimeList, Kitsu, and Anilist over their development. The current use of Anilist is due to Dragon Fire's status as a data mod there.", "The `company` command has Dragon Fire's logo inserted into it manually, Clearbit does not actually acknowledge us.", "Xiao used to have `gelbooru` and `konachan` commands, but due to their similarity to `danbooru`, they were removed.", @@ -52,5 +52,6 @@ "Xiao began development in February 2017, and was most likely active sometime in 2016 under a different name.", "The command with the most lines of code is, oddly enough, `anime`, at 189.", "The `ship` command gives a special response if the compatability is 69.", - "The `jeopardy` command will play the Jeopardy think music if both you and the bot are in a voice channel when the command is used." + "The `jeopardy` command will play the Jeopardy think music if both you and the bot are in a voice channel when the command is used.", + "Dragon Fire, the developer of Xiao, is forever alone." ] diff --git a/commands/random-seed/friendship.js b/commands/random-seed/friendship.js index 8cd98b21..2f768c65 100644 --- a/commands/random-seed/friendship.js +++ b/commands/random-seed/friendship.js @@ -52,7 +52,15 @@ module.exports = class FriendshipCommand extends Command { async run(msg, { first, second }) { if (first.id === second.id) return msg.reply('You should be good friends with yourself.'); - const calculated = -Math.abs(Number.parseInt(BigInt(first.id) - BigInt(second.id), 10)); + let calculated; + const owner = this.client.isOwner(first) || this.client.isOwner(second); + const authorUser = first.id === msg.author.id || second.id === msg.author.id; + if (owner) { + if (authorUser) calculated = 100; + else calculated = 0; + } else { + calculated = -Math.abs(Number.parseInt(BigInt(first.id) - BigInt(second.id), 10)); + } const random = MersenneTwister19937.seed(calculated); const level = integer(0, 100)(random); const firstAvatarURL = first.displayAvatarURL({ format: 'png', size: 512 }); @@ -79,7 +87,7 @@ module.exports = class FriendshipCommand extends Command { ctx.font = '60px Pinky Cupid'; ctx.fillStyle = percentColor(level / 100, percentColors); ctx.fillText(`~${level}%~`, 600, 230); - ctx.fillText(this.calculateLevelText(level), 600, 296); + ctx.fillText(this.calculateLevelText(level, owner, authorUser), 600, 296); ctx.font = '90px Pinky Cupid'; ctx.fillText(level > 49 ? '👍' : '👎', 600, 100); return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'friendship.png' }] }); @@ -88,7 +96,11 @@ module.exports = class FriendshipCommand extends Command { } } - calculateLevelText(level) { + calculateLevelText(level, owner, authorUser) { + if (owner) { + if (authorUser) return 'Perfect'; + else return 'Yuck'; + } if (level === 0) return 'Abysmal'; if (level > 0 && level < 10) return 'Horrid'; if (level > 9 && level < 20) return 'Awful'; diff --git a/commands/random-seed/ship.js b/commands/random-seed/ship.js index 14cd93e2..71d56cfa 100644 --- a/commands/random-seed/ship.js +++ b/commands/random-seed/ship.js @@ -52,7 +52,14 @@ module.exports = class ShipCommand extends Command { async run(msg, { first, second }) { if (first.id === second.id) return msg.reply('Shipping someone with themselves would be pretty weird.'); - const calculated = Math.abs(Number.parseInt(BigInt(first.id) - BigInt(second.id), 10)); + let calculated; + const owner = this.client.isOwner(first) || this.client.isOwner(second); + const authorUser = first.id === msg.author.id || second.id === msg.author.id; + if (owner) { + calculated = 0; + } else { + calculated = Math.abs(Number.parseInt(BigInt(first.id) - BigInt(second.id), 10)); + } const random = MersenneTwister19937.seed(calculated); const level = integer(0, 100)(random); const firstAvatarURL = first.displayAvatarURL({ format: 'png', size: 512 }); @@ -79,7 +86,7 @@ module.exports = class ShipCommand extends Command { ctx.font = '60px Pinky Cupid'; ctx.fillStyle = percentColor(level / 100, percentColors); ctx.fillText(`~${level}%~`, 600, 230); - ctx.fillText(this.calculateLevelText(level), 600, 296); + ctx.fillText(this.calculateLevelText(level, owner, authorUser), 600, 296); ctx.font = '90px Pinky Cupid'; ctx.fillText(level > 49 ? '❤️' : '💔', 600, 100); return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'ship.png' }] }); @@ -88,7 +95,11 @@ module.exports = class ShipCommand extends Command { } } - calculateLevelText(level) { + calculateLevelText(level, owner, authorUser) { + if (owner) { + if (authorUser) return 'Pervert'; + else return 'Yuck'; + } if (level === 0) return 'Abysmal'; if (level > 0 && level < 10) return 'Horrid'; if (level > 9 && level < 20) return 'Awful'; diff --git a/package.json b/package.json index 763f407c..05321a52 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xiao", - "version": "114.31.2", + "version": "114.31.3", "description": "Your personal server companion.", "main": "Xiao.js", "scripts": {