forked from Pogy-Bot/Pogy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d03720e
commit d938447
Showing
5 changed files
with
200 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"version": "2.0.0", | ||
"tasks": [ | ||
{ | ||
"type": "npm", | ||
"script": "install", | ||
"group": "clean", | ||
"problemMatcher": [], | ||
"label": "npm: install", | ||
"detail": "install dependencies from package" | ||
} | ||
] | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
const Command = require("../../structures/Command"); | ||
const { MessageEmbed, Message } = require("discord.js"); | ||
const crc32 = require("crc").crc32; | ||
module.exports = class extends Command { | ||
constructor(...args) { | ||
super(...args, { | ||
name: "ship", | ||
description: "Ships two users together and calculates compatibility", | ||
category: "Fun", | ||
cooldown: 15, | ||
}) | ||
} | ||
|
||
async run(message) { | ||
const mentions = message.mentions.members; | ||
|
||
if (mentions.length < 2) { | ||
return message.channel.send('Please provide two names to ship! Example: !ship Alice Bob'); | ||
} | ||
|
||
const users = Array.from(mentions.values()).slice(0, 2); | ||
|
||
const combinedNames = users[0].username + users[1].username; | ||
|
||
const hash = crc32(combinedNames); | ||
|
||
const shipPercentage = Math.abs(hash % 101); | ||
|
||
const shipName = users[0].username.slice(0, Math.ceil(users[0].username.length / 2)) + users[1].username.slice(Math.floor(users[1].username.length / 2)); | ||
|
||
message.channel.send({ | ||
content: `:heartpulse: MATCHMAKING :heartpulse:\n:small_red_triangle_down: *\`${users[0].username}\`*\n:small_red_triangle_up: *\`${users[1].username}\`*`, | ||
embeds: [ | ||
new MessageEmbed() | ||
.setDescription(`${users[0].username}`) | ||
] | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters