5
5
<p align =" center " >
6
6
<a href="https://www.npmjs.com/package/falgames"><img src="https://img.shields.io/npm/v/falgames.svg?maxAge=3600" alt="npm version" /></a>
7
7
<a href="https://www.npmjs.com/package/falgames"><img src="https://img.shields.io/npm/dt/falgames.svg?maxAge=3600" alt="npm downloads" /></a>
8
- <a title="Support server" href="https://discord.gg/8WrAtVYVKR">
9
- <img src="https://img.shields.io/discord/742332099788275732.svg?&logo=discord&logoColor=ffffff&color=7389D8&labelColor=6A7EC2&label=Support" alt="Support server">
10
- </a>
11
- <a title="Stars" href="https://github.com/falcao-g/falbot">
12
- <img src="https://img.shields.io/github/stars/falcao-g/Falgames" alt="Stars">
8
+ <a href="https://jsr.io/@falcao/falgames"><img src="https://jsr.io/badges/@falcao/falgames" alt="jsr version" /></a>
9
+ <a href="https://jsr.io/@falcao/falgames"><img src="https://jsr.io/badges/@falcao/falgames/score" alt="jsr score" /></a>
10
+ <a title="Stars" href="https://github.com/falcao-g/falbot">
11
+ <img src="https://img.shields.io/github/stars/falcao-g/Falgames" alt="Stars">
13
12
</a>
14
13
</p >
15
14
@@ -28,6 +27,12 @@ Please note that Node v18+ and Discord.js v14+ is required.
28
27
npm i falgames
29
28
```
30
29
30
+ or
31
+
32
+ ``` bash
33
+ deno add @falcao/falgames
34
+ ```
35
+
31
36
## 📷 Preview
32
37
33
38
![ Preview] ( /assets/readme.png )
@@ -37,47 +42,47 @@ npm i falgames
37
42
Starting a game with Falgames is as easy as the following example:
38
43
39
44
``` js
40
- const { Snake } = require (' falgames' );
45
+ const { Snake } = require (" falgames" ) // or import { Snake } from "falgames"
41
46
42
47
const Game = new Snake ({
43
- message: message,
44
- isSlashGame: false ,
45
- embed: {
46
- title: ' Snake Game' ,
47
- overTitle: ' Game Over' ,
48
- scoreText: ' **Score:**' ,
49
- color: ' #551476'
50
- },
51
- emojis: {
52
- board: ' ⬛ ' ,
53
- up: ' ⬆️ ' ,
54
- down: ' ⬇️ ' ,
55
- left: ' ⬅️ ' ,
56
- right: ' ➡️ ' ,
57
- },
58
- snake: { head: ' 🟢 ' , body: ' 🟩 ' , tail: ' 🟢 ' , over: ' 💀 ' },
59
- foods: [' 🍎 ' , ' 🍇 ' , ' 🍊 ' , ' 🫐 ' , ' 🥕 ' , ' 🥝 ' , ' 🌽 ' ],
60
- stopButton: ' Stop' ,
61
- timeoutTime: 60000 ,
62
- playerOnlyMessage: ' Only {player} can use these buttons.'
63
- });
64
-
65
- Game .startGame ();
66
- Game .on (' gameOver' , result => {
67
- console .log (result); // => { result... }
68
- });
48
+ message: message,
49
+ isSlashGame: false ,
50
+ embed: {
51
+ title: " Snake Game" ,
52
+ overTitle: " Game Over" ,
53
+ scoreText: " **Score:**" ,
54
+ color: " #551476" ,
55
+ },
56
+ emojis: {
57
+ board: " ⬛ " ,
58
+ up: " ⬆️ " ,
59
+ down: " ⬇️ " ,
60
+ left: " ⬅️ " ,
61
+ right: " ➡️ " ,
62
+ },
63
+ snake: { head: " 🟢 " , body: " 🟩 " , tail: " 🟢 " , over: " 💀 " },
64
+ foods: [" 🍎 " , " 🍇 " , " 🍊 " , " 🫐 " , " 🥕 " , " 🥝 " , " 🌽 " ],
65
+ stopButton: " Stop" ,
66
+ timeoutTime: 60000 ,
67
+ playerOnlyMessage: " Only {player} can use these buttons." ,
68
+ })
69
+
70
+ Game .startGame ()
71
+ Game .on (" gameOver" , ( result ) => {
72
+ console .log (result) // => { result... }
73
+ })
69
74
```
70
75
71
76
Slash commands are also supported, just set the ` isSlashGame ` option to ` true ` and the message option to ` interaction ` :
72
77
73
78
``` js
74
- const { Snake } = require (' falgames' );
79
+ const { Snake } = require (" falgames" )
75
80
76
81
const Game = new Snake ({
77
- message: interaction,
78
- isSlashGame: true ,
79
- // ...
80
- });
82
+ message: interaction,
83
+ isSlashGame: true ,
84
+ // ...
85
+ })
81
86
```
82
87
83
88
Make sure to check out the [ examples] ( examples ) folder for more examples.
0 commit comments