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
8f536eb6
Commit
8f536eb6
authored
Feb 24, 2021
by
Reviath
Browse files
Options
Downloads
Patches
Plain Diff
Slots command is ready to use with MySQL
parent
bbb5762a
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
commands/remove-money.js
+0
-17
0 additions, 17 deletions
commands/remove-money.js
commands/slots.js
+28
-8
28 additions, 8 deletions
commands/slots.js
with
28 additions
and
25 deletions
commands/remove-money.js
deleted
100644 → 0
+
0
−
17
View file @
bbb5762a
const
Discord
=
require
(
'
discord.js
'
);
const
settings
=
require
(
'
../settings.json
'
);
const
db
=
require
(
'
quick.db
'
);
exports
.
run
=
async
(
client
,
message
,
args
)
=>
{
if
(
!
settings
.
author
.
includes
(
message
.
author
.
id
))
return
;
let
user
=
args
[
0
]
let
money
=
args
[
1
]
if
(
!
user
)
return
message
.
channel
.
send
(
'
Who do you want to remove
'
);
if
(
!
money
)
return
message
.
channel
.
send
(
'
How much money do you want to remove
'
);
db
.
subtract
(
`Balance_
${
user
}
`
,
money
).
then
(
message
.
channel
.
send
(
'
Successfully Removed
'
))
}
module
.
exports
.
help
=
{
name
:
'
remove-money
'
,
aliases
:
[
'
removemoney
'
]
};
This diff is collapsed.
Click to expand it.
commands/slots.js
+
28
−
8
View file @
8f536eb6
const
db
=
require
(
'
quick.db
'
);
const
Discord
=
require
(
'
discord.js
'
);
const
Discord
=
require
(
'
discord.js
'
);
exports
.
run
=
async
(
client
,
message
,
args
)
=>
{
exports
.
run
=
async
(
client
,
message
,
args
,
connection
)
=>
{
let
slots
=
[
"
<a:blue_fire:801857759989465170>
"
,
"
<a:orange_fire:801858052163895306>
"
,
"
<a:green_fire:801858041137332225>
"
];
let
slots
=
[
"
<a:blue_fire:801857759989465170>
"
,
"
<a:orange_fire:801858052163895306>
"
,
"
<a:green_fire:801858041137332225>
"
];
let
result1
=
Math
.
floor
((
Math
.
random
()
*
slots
.
length
));
let
result1
=
Math
.
floor
((
Math
.
random
()
*
slots
.
length
));
let
result2
=
Math
.
floor
((
Math
.
random
()
*
slots
.
length
));
let
result2
=
Math
.
floor
((
Math
.
random
()
*
slots
.
length
));
let
result3
=
Math
.
floor
((
Math
.
random
()
*
slots
.
length
));
let
result3
=
Math
.
floor
((
Math
.
random
()
*
slots
.
length
));
let
icon
=
message
.
author
.
avatarURL
();
let
icon
=
message
.
author
.
avatarURL
();
let
number
=
args
[
0
];
let
number
=
args
[
0
];
let
bal
=
await
db
.
get
(
`Balance_
${
message
.
author
.
id
}
`
);
const
cash
=
await
new
Promise
((
resolve
,
reject
)
=>
{
if
(
number
>
bal
||
number
<=
0
||
!
bal
)
return
message
.
channel
.
send
(
`Your balance is under the value you entered.`
)
connection
.
query
(
`SELECT cash FROM cashes WHERE guildid ='
${
message
.
guild
.
id
}
' AND userid ='
${
message
.
author
.
id
}
'`
,
function
(
err
,
result
)
{
if
(
err
)
reject
(
err
);
resolve
(
result
);
});
});
var
money
=
""
;
if
(
cash
.
length
<
1
)
{
money
=
0
;
}
else
{
money
=
cash
[
0
].
cash
}
if
(
number
>
money
||
number
<=
0
||
!
money
)
return
message
.
channel
.
send
(
`Your balance is under the value you entered.`
)
let
slotNumber
;
let
slotNumber
;
if
(
!
number
)
return
message
.
channel
.
send
(
'
Please specify an amout to use.
'
);
if
(
!
number
)
return
message
.
channel
.
send
(
'
Please specify an amout to use.
'
);
if
(
number
>
50000
||
number
==
"
all
"
)
{
if
(
number
>
50000
||
number
==
"
all
"
)
{
if
(
50000
>
bal
){
if
(
50000
>
money
){
slotNumber
=
bal
;
slotNumber
=
money
;
}
else
{
}
else
{
slotNumber
=
50000
;
slotNumber
=
50000
;
}
}
...
@@ -36,7 +48,11 @@ let slots = ["<a:blue_fire:801857759989465170>", "<a:orange_fire:801858052163895
...
@@ -36,7 +48,11 @@ let slots = ["<a:blue_fire:801857759989465170>", "<a:orange_fire:801858052163895
.
addField
(
'
Result:
'
,
slots
[
result1
]
+
slots
[
result2
]
+
slots
[
result3
],
true
)
.
addField
(
'
Result:
'
,
slots
[
result1
]
+
slots
[
result2
]
+
slots
[
result3
],
true
)
.
addField
(
`You won `
,
`
${
slotNumber
*
2
}
`
)
.
addField
(
`You won `
,
`
${
slotNumber
*
2
}
`
)
.
setColor
(
0xF4E842
)
.
setColor
(
0xF4E842
)
msg
.
edit
(
embed
).
then
(
db
.
add
(
`Balance_
${
message
.
author
.
id
}
`
,
slotNumber
));
msg
.
edit
(
embed
)
let
sql
=
`UPDATE cashes SET cash ='
${
parseInt
(
money
)
+
parseInt
(
slotNumber
)}
' WHERE guildid ='
${
message
.
guild
.
id
}
' AND userid='
${
message
.
author
.
id
}
'`
connection
.
query
(
sql
,
function
(
err
,
result
)
{
if
(
err
)
throw
err
;
})
},
5000
)
},
5000
)
}
else
{
}
else
{
setTimeout
(
async
function
()
{
setTimeout
(
async
function
()
{
...
@@ -46,7 +62,11 @@ let slots = ["<a:blue_fire:801857759989465170>", "<a:orange_fire:801858052163895
...
@@ -46,7 +62,11 @@ let slots = ["<a:blue_fire:801857759989465170>", "<a:orange_fire:801858052163895
.
addField
(
'
Result:
'
,
slots
[
result1
]
+
slots
[
result2
]
+
slots
[
result3
],
true
)
.
addField
(
'
Result:
'
,
slots
[
result1
]
+
slots
[
result2
]
+
slots
[
result3
],
true
)
.
setColor
(
0xF4E842
)
.
setColor
(
0xF4E842
)
.
addField
(
`You lost `
,
`
${
slotNumber
}
`
)
.
addField
(
`You lost `
,
`
${
slotNumber
}
`
)
msg
.
edit
(
embed2
).
then
(
db
.
subtract
(
`Balance_
${
message
.
author
.
id
}
`
,
slotNumber
));
msg
.
edit
(
embed2
)
let
sql2
=
`UPDATE cashes SET cash ='
${
parseInt
(
money
)
-
parseInt
(
slotNumber
)}
' WHERE guildid ='
${
message
.
guild
.
id
}
' AND userid='
${
message
.
author
.
id
}
'`
connection
.
query
(
sql2
,
function
(
err
,
result
)
{
if
(
err
)
throw
err
;
})
},
5000
)
},
5000
)
}
}
}
}
...
...
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