Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Koakuma
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Reviath
Koakuma
Commits
c848e3ca
Commit
c848e3ca
authored
Jan 21, 2021
by
Reviath
Browse files
Options
Downloads
Patches
Plain Diff
Added roulette command
parent
feb27a78
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
commands/roulette.js
+80
-0
80 additions, 0 deletions
commands/roulette.js
with
80 additions
and
0 deletions
commands/roulette.js
0 → 100644
+
80
−
0
View file @
c848e3ca
const
Discord
=
require
(
"
discord.js
"
);
const
db
=
require
(
"
quick.db
"
);
const
ms
=
require
(
"
parse-ms
"
);
module
.
exports
.
run
=
async
(
client
,
message
,
args
)
=>
{
let
user
=
message
.
author
;
function
isOdd
(
num
)
{
if
((
num
%
2
)
==
0
)
return
false
;
else
if
((
num
%
2
)
==
1
)
return
true
;
}
let
colour
=
args
[
0
];
let
money
=
parseInt
(
args
[
1
]);
let
moneydb
=
await
db
.
fetch
(
`Balance_
${
user
.
id
}
`
)
let
random
=
Math
.
floor
(
Math
.
random
()
*
37
);
let
moneyhelp
=
new
Discord
.
MessageEmbed
()
.
setColor
(
'
BLUE
'
)
.
setDescription
(
`:x: Specify an amount to gamble | .roulette <color> <amount>`
);
let
moneymore
=
new
Discord
.
MessageEmbed
()
.
setColor
(
"
BLUE
"
)
.
setDescription
(
`:x: You are betting more than you have`
);
let
colorbad
=
new
Discord
.
MessageEmbed
()
.
setColor
(
"
BLUE
"
)
.
setDescription
(
`:x Specify a color | Red [1.5x] Black [2x] Green [15x]`
);
if
(
!
colour
)
return
message
.
channel
.
send
(
colorbad
);
colour
=
colour
.
toLowerCase
()
if
(
!
money
)
return
message
.
channel
.
send
(
moneyhelp
);
if
(
money
>
moneydb
)
return
message
.
channel
.
send
(
moneymore
);
if
(
colour
==
"
b
"
||
colour
.
includes
(
"
black
"
))
colour
=
0
;
else
if
(
colour
==
"
r
"
||
colour
.
includes
(
"
red
"
))
colour
=
1
;
else
if
(
colour
==
"
g
"
||
colour
.
includes
(
"
green
"
))
colour
=
2
;
else
return
message
.
channel
.
send
(
colorbad
);
if
(
random
==
0
&&
colour
==
2
)
{
// Green
money
*=
15
db
.
add
(
`Balance_
${
user
.
id
}
`
,
money
)
let
moneyEmbed1
=
new
Discord
.
MessageEmbed
()
.
setColor
(
"
#FFFFFF
"
)
.
setDescription
(
`<:Green:618767721361833995> You won
${
money
}
coins\n\nMultiplier: 15x`
);
message
.
channel
.
send
(
moneyEmbed1
)
console
.
log
(
`
${
message
.
author
.
tag
}
Won
${
money
}
on green`
)
}
else
if
(
isOdd
(
random
)
&&
colour
==
1
)
{
// Red
money
=
parseInt
(
money
*
1.5
)
db
.
add
(
`Balance_
${
user
.
id
}
`
,
money
)
let
moneyEmbed2
=
new
Discord
.
MessageEmbed
()
.
setColor
(
"
#FFFFFF
"
)
.
setDescription
(
`<:Red:618767705444450342> You won
${
money
}
coins\n\nMultiplier: 1.5x`
);
message
.
channel
.
send
(
moneyEmbed2
)
}
else
if
(
!
isOdd
(
random
)
&&
colour
==
0
)
{
// Black
money
=
parseInt
(
money
*
2
)
db
.
add
(
`Balance_
${
user
.
id
}
`
,
money
)
let
moneyEmbed3
=
new
Discord
.
MessageEmbed
()
.
setColor
(
"
#FFFFFF
"
)
.
setDescription
(
`<:Black:618767682996666408> You won
${
money
}
coins\n\nMultiplier: 2x`
);
message
.
channel
.
send
(
moneyEmbed3
)
}
else
{
// Wrong
db
.
subtract
(
`Balance_
${
user
.
id
}
`
,
money
)
let
moneyEmbed4
=
new
Discord
.
MessageEmbed
()
.
setColor
(
"
#FFFFFF
"
)
.
setDescription
(
`<:Cross:618736602901905418> You lost
${
money
}
coins\n\nMultiplier: 0x`
);
message
.
channel
.
send
(
moneyEmbed4
)
}
}
module
.
module
.
exports
.
help
=
{
name
:
"
roulette
"
,
aliases
:
[
"
roul
"
]
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment