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
3a891d23
Commit
3a891d23
authored
Apr 17, 2021
by
Reviath
Browse files
Options
Downloads
Patches
Plain Diff
Added guild member add event.
parent
67694cf7
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
events/memberadd.js
+36
-0
36 additions, 0 deletions
events/memberadd.js
events/ready.js
+1
-1
1 addition, 1 deletion
events/ready.js
with
37 additions
and
1 deletion
events/memberadd.js
0 → 100644
+
36
−
0
View file @
3a891d23
module
.
exports
=
{
guildmemberadd
:
(
client
,
connection
)
=>
{
client
.
on
(
'
guildMemberAdd
'
,
async
(
member
)
=>
{
let
channel_db
;
let
message_db
;
await
connection
.
query
(
`SELECT message FROM welcome_message WHERE guild ='
${
member
.
guild
.
id
}
'`
,
function
(
err
,
result
)
{
if
(
err
){
throw
err
;
};
if
(
result
.
length
<
1
)
{
message_db
=
`Welcome to server <@
${
member
.
id
}
>`
;
}
else
{
message_db
=
result
[
0
].
message
;
};
});
await
connection
.
query
(
`SELECT channel FROM welcome_channel WHERE guild ='
${
member
.
guild
.
id
}
'`
,
function
(
err
,
result
)
{
if
(
err
){
throw
err
;
};
if
(
result
.
length
<
1
)
{
return
;
}
else
{
channel_db
=
result
[
0
].
channel
;
const
channel
=
member
.
guild
.
channels
.
cache
.
get
(
channel_db
);
if
(
!
channel
)
{
return
;
};
channel
.
send
(
message_db
?
message_db
.
replace
(
'
{mention}
'
,
`
${
member
}
`
).
replace
(
'
{username}
'
,
`
${
member
.
user
.
username
}
`
)
:
``
).
catch
(
e
=>
{
return
;
});
}
});
});
}
};
This diff is collapsed.
Click to expand it.
events/ready.js
+
1
−
1
View file @
3a891d23
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