This is a node.js package that allows you to make a roulette gif image as easy as possible
$ npm install roulette-gif
$ yarn add roulette-gif
- Simple & easy to use
- You can edit everything in the wheel
Join our support server for any question HL Services
At first you need to install the package
const { Wheel } = require('roulette-gif')
const wheel = new Wheel()
let slots = [
{
username: "Zaid",
number: 1,
image: 'Some avatar url' // Must be png or any supported image by canvas
},
{
username: "Ahmed",
number: 2,
image: 'Some avatar url'
},
]
let {
buffer,
winner,
lastFrame
} = await wheel.createGif({
slots,
stream: false, // Set it to true if you want to return stream insted of buffer
wheelStroke: {
color: '#fff',
width: 5
},
slotStroke: {
color: '#fff',
width: 5
},
imageStroke: {
color: '#fff',
width: 5
},
winnerSlotColor: 'Gold'
})
You can use the buffer
to send the roulette gif or save it and if you want to get a stream
insted of buffer you can use stream: true
The lastFrame
variable is a buffer of the last image in the gif
The winner
variable returns the winner slot
Variable | Required | Default | Description | Type |
---|---|---|---|---|
stream | false |
false |
Choice to return a buffer or stream | Boolean |
slots | true |
null |
The slots array of the users | Array |
wheelStroke | false |
{ width: 0, color: '#fff' } |
The stroke object of the wheel | Object |
slotStroke | false |
{ width: 0, color: '#fff' } |
The stroke object of the slot | Object |
imageStroke | false |
{ width: 0, color: '#fff' } |
The stroke object of the center image | Object |
winnerSlotColor | false |
Slot Color |
Change the winner slot color | Color |
text | false |
{ color: '#fff', size: 14 } |
The text options | Object |
arrow | false |
Simple arrow |
Use url image to change the wheel arrow | URL Image |
- Send the wheel in discord
let { buffer, winner } wheel.createGif({
slots
})
<Interaction | Channel>.send({
files: [{ attachment: buffer, name: "roulette.png" }],
content: `Congratulations ${winner.username} 🎉 you won`
})
- Custom arrow
wheel.createGif({
slots,
arrow: 'https://example.com/arrow.png'
})
- Custom wheel stroke
wheel.createGif({
slots,
wheelStroke: {
color: 'red', // You can use hexCodes here
width: 5
}
})
- Custom slot stroke
wheel.createGif({
slots,
slotStroke: {
color: 'purple', // You can use hexCodes here
width: 5
}
})
- Custom image stroke
wheel.createGif({
slots,
imageStroke: {
color: 'green', // You can use hexCodes here
width: 5
}
})
- Custom text
wheel.createGif({
slots,
text: {
color: 'blue', // You can use hexCodes here
size: 10
}
})
- Discord zd8
- Discord Server HL Service
- Github zsl8