Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jjoaovitor7/discord-jokenpo
Jokenpo para bots do Discord.
https://github.com/jjoaovitor7/discord-jokenpo
discord discord-games jokenpo js node
Last synced: 3 months ago
JSON representation
Jokenpo para bots do Discord.
- Host: GitHub
- URL: https://github.com/jjoaovitor7/discord-jokenpo
- Owner: jjoaovitor7
- License: mit
- Created: 2021-08-14T20:36:22.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-08-13T09:10:34.000Z (over 2 years ago)
- Last Synced: 2024-09-29T09:20:29.245Z (3 months ago)
- Topics: discord, discord-games, jokenpo, js, node
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/discord-jokenpo
- Size: 34.2 KB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# discord-jokenpo
[![discord-jokenpo](https://nodei.co/npm/discord-jokenpo.png)](https://nodei.co/npm/discord-jokenpo/)
Jokenpo para bots do Discord.
## Instalação (npm)
```js
npm i discord-jokenpo
```## Exemplo de uso
```js
const J = require("discord-jokenpo");const messages = {
fail: "Tente jj jokenpo `[pedra|papel|tesoura]`.\nex.: `jj jokenpo pedra`",
gameStatus: {
inProgress: "Partida iniciada ou há uma partida em andamento.",
cancel: "Partida cancelada.",
},
messageTo: {
user: "Aqui você digita a opção `[pedra | papel | tesoura]`.",
opponent:
"Um usuário te desafiou para uma partida de jokenpo!\nPara aceitar é necessário apenas digitar a opção `[pedra | papel | tesoura]`",
timeout: "O tempo limite é de 60s.",
},
};client.on("messageCreate", async (message) => {
const Jokenpo = new J(message);
Jokenpo.setConfig(messages, "pt-br");
// Jokenpo.setConfig(messages, "en");Jokenpo.play("pedra")
.then(() => {
const r = Jokenpo.result();
if (r.player === false && r.bot === false) {
message.channel.send(`Empate!`);
} else if (r.bot === true) {
message.channel.send(`<@${client.user.id}> ganhou.`);
} else if (r.player === true) {
message.channel.send(`<@${message.author.id}> ganhou.`);
}
}).catch(console.error);
});
```