Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Byakuren
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
Byakuren
Commits
2702613c
Commit
2702613c
authored
Apr 17, 2021
by
Reviath
Browse files
Options
Downloads
Patches
Plain Diff
Update events, added user-info command
parent
45848c36
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
commands/user-info.js
+28
-0
28 additions, 0 deletions
commands/user-info.js
events/message.js
+4
-6
4 additions, 6 deletions
events/message.js
events/ready.js
+1
-2
1 addition, 2 deletions
events/ready.js
with
33 additions
and
8 deletions
commands/user-info.js
0 → 100644
+
28
−
0
View file @
2702613c
const
Discord
=
require
(
'
discord.js
'
);
const
moment
=
require
(
'
moment
'
);
const
errors
=
require
(
'
../errors.json
'
);
exports
.
run
=
(
client
,
message
,
args
)
=>
{
let
user
=
message
.
guild
.
member
(
message
.
mentions
.
users
.
first
()
||
message
.
author
||
message
.
guild
.
members
.
cache
.
get
(
args
[
0
]));
client
.
users
.
cache
.
get
(
user
);
const
embed
=
new
Discord
.
MessageEmbed
()
.
setColor
(
0x00AE86
)
.
setTitle
(
"
User Information
"
)
.
setTimestamp
()
.
addField
(
'
User:
'
,
`<@
${
user
.
id
}
>`
)
.
addField
(
'
User ID:
'
,
`
${
user
.
id
}
`
)
.
addField
(
'
Created At:
'
,
`
${
moment
(
user
.
user
.
createdAt
).
format
(
'
lll
'
)
+
'
\n
'
+
moment
(
new
Date
()).
diff
(
user
.
user
.
createdAt
,
'
days
'
)
+
'
days ago
'
}
`
)
.
addField
(
'
Joined At:
'
,
`
${
moment
(
user
.
joinedAt
).
format
(
'
lll
'
)
+
'
\n
'
+
moment
(
new
Date
()).
diff
(
user
.
joinedAt
,
'
days
'
)
+
'
days ago
'
}
`
)
.
addField
(
'
Last Message:
'
,
`
${
user
.
lastMessage
}
`
)
message
.
channel
.
send
(
embed
).
catch
(
e
=>
{
message
.
channel
.
send
(
errors
.
cannot_send_embed
).
catch
(
e
=>
{
return
;
});
return
;
});
};
module
.
exports
.
help
=
{
name
:
'
userinfo
'
,
aliases
:
[
'
user-info
'
,
'
user_info
'
,
'
whois
'
]
};
This diff is collapsed.
Click to expand it.
events/message.js
+
4
−
6
View file @
2702613c
module
.
exports
=
{
message
:
(
client
,
config
,
Discord
,
connection
)
=>
{
client
.
on
(
'
message
'
,
async
message
=>
{
let
config
=
require
(
'
../config.json
'
)
let
config
=
require
(
'
../config.json
'
)
;
const
prefixdb
=
await
new
Promise
((
resolve
,
reject
)
=>
{
connection
.
query
(
`SELECT prefix FROM prefixes WHERE guild ='
${
message
.
guild
.
id
}
'`
,
function
(
err
,
result
)
{
if
(
err
)
...
...
@@ -15,8 +13,8 @@ module.exports = {
if
(
prefixdb
.
length
<
1
)
{
prefix
=
config
.
prefix
;
}
else
{
prefix
=
prefixdb
[
0
].
prefix
}
prefix
=
prefixdb
[
0
].
prefix
;
}
;
if
(
message
.
channel
.
type
===
"
dm
"
)
return
;
let
args
=
message
.
content
.
slice
(
prefix
.
length
).
trim
().
split
(
'
'
);
let
cmd
=
args
.
shift
().
toLowerCase
();
...
...
@@ -31,7 +29,7 @@ module.exports = {
command
.
run
(
client
,
message
,
args
,
connection
);
}
catch
(
err
)
{
if
(
err
)
return
undefined
;
}
}
;
}
)}
};
This diff is collapsed.
Click to expand it.
events/ready.js
+
1
−
2
View file @
2702613c
const
config
=
require
(
'
../config.json
'
);
module
.
exports
=
{
ready
:
(
client
)
=>
{
client
.
login
(
config
.
token
).
catch
(
e
=>
{
console
.
warn
(
`An error occurred while connecting to Discord
${
e
}
`
);
process
.
exit
(
1
)
process
.
exit
(
1
)
;
});
client
.
on
(
'
ready
'
,
async
()
=>
{
client
.
user
.
setActivity
({
...
...
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