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
8478d8c2
Commit
8478d8c2
authored
Feb 24, 2021
by
Reviath
Browse files
Options
Downloads
Patches
Plain Diff
Fixed message event and balance command
parent
ad41c724
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
commands/add-money.js
+0
-19
0 additions, 19 deletions
commands/add-money.js
commands/balance.js
+18
-14
18 additions, 14 deletions
commands/balance.js
events/message.js
+3
-4
3 additions, 4 deletions
events/message.js
with
21 additions
and
37 deletions
commands/add-money.js
deleted
100644 → 0
+
0
−
19
View file @
ad41c724
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 add
'
);
if
(
!
money
)
return
message
.
channel
.
send
(
'
How much money do you want to add
'
);
db
.
add
(
`Balance_
${
user
}
`
,
money
)
message
.
channel
.
send
(
'
Successfully Added
'
)
}
module
.
exports
.
help
=
{
name
:
'
add-money
'
,
aliases
:
[
'
addmoney
'
]
};
This diff is collapsed.
Click to expand it.
commands/balance.js
+
18
−
14
View file @
8478d8c2
const
Settings
=
require
(
'
../settings
'
);
const
Discord
=
require
(
'
discord.js
'
);
const
ms
=
require
(
'
parse-ms
'
);
const
db
=
require
(
'
quick.db
'
);
exports
.
run
=
async
(
client
,
message
,
args
)
=>
{
exports
.
run
=
async
(
client
,
message
,
args
,
connection
)
=>
{
function
numberWithCommas
(
x
)
{
var
parts
=
x
.
toString
().
split
(
"
.
"
);
parts
[
0
]
=
parts
[
0
].
replace
(
/
\B(?=(\d{3})
+
(?!\d))
/g
,
"
.
"
);
return
parts
.
join
(
"
,
"
);
}
let
balance
=
await
db
.
get
(
`Balance_
${
message
.
author
.
id
}
`
);
if
(
balance
===
null
)
{
balance
=
"
0
"
const
cash
=
await
new
Promise
((
resolve
,
reject
)
=>
{
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
;
}
let
balances
=
numberWithCommas
(
balance
);
message
.
channel
.
send
(
`You balance is
${
balances
}
$`
);
else
{
money
=
cash
[
0
].
cash
}
let
balances
=
numberWithCommas
(
money
);
message
.
channel
.
send
(
`Your balance is
${
balances
}
\$
`
);
};
module
.
exports
.
help
=
{
name
:
'
balance
'
,
aliases
:
[
'
bakiye
'
,
'
bal
'
,
'
cash
'
]
aliases
:
[
'
bal
'
,
'
cash
'
]
};
This diff is collapsed.
Click to expand it.
events/message.js
+
3
−
4
View file @
8478d8c2
...
...
@@ -3,14 +3,13 @@ module.exports = {
message
:
(
client
,
settings
,
Discord
,
connection
)
=>
{
client
.
on
(
'
message
'
,
async
message
=>
{
let
settings
=
require
(
'
../settings.json
'
)
let
guildid
=
message
.
guild
.
id
;
var
sql
=
`SELECT prefix FROM prefixes WHERE guildid ='`
+
guildid
+
`'`
;
var
prefix
=
""
;
connection
.
query
(
sql
,
function
(
err
,
result
)
{
if
(
result
.
length
==
0
)
prefix
=
settings
.
prefix
;
if
(
result
.
length
>
0
)
prefix
=
result
[
0
].
prefix
;
let
settings
=
require
(
'
../settings.json
'
)
let
prefix
=
settings
.
prefix
;
if
(
result
==
null
)
prefix
=
settings
.
prefix
;
if
(
result
)
prefix
=
result
;
if
(
message
.
channel
.
type
===
"
dm
"
)
return
;
let
args
=
message
.
content
.
slice
(
prefix
.
length
).
trim
().
split
(
'
'
);
let
cmd
=
args
.
shift
().
toLowerCase
();
...
...
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