FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
NotaBot/module_mention.lua at master · DigitalPulseSoftware/NotaBot · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
DigitalPulseSoftware
/
NotaBot
Public
Notifications
You must be signed in to change notification settings
Fork
13
Star
25
Code
Issues
13
Pull requests
9
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
NotaBot
/
module_mention.lua
Copy path
More file actions
More file actions
Latest commit
History
History
History
66 lines (56 loc) · 1.47 KB
Breadcrumbs
NotaBot
/
module_mention.lua
Copy path
File metadata and controls
66 lines (56 loc) · 1.47 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
--
Copyright (C) 2018 Jérôme Leclercq
--
This file is part of the "Not a Bot" application
--
For conditions of distribution and use, see copyright notice in LICENSE
local
client
=
Client
local
discordia
=
Discordia
local
bot
=
Bot
local
enums
=
discordia
.
enums
Module
.
Name
=
"
mention
"
function
Module
:
GetConfigTable
()
return
{
{
Name
=
"
Emoji
"
,
Description
=
"
Emoji to add as a reaction
"
,
Type
=
bot
.
ConfigType
.
Emoji
,
Default
=
"
mention
"
},
{
Name
=
"
ReactOnEveryoneOrHere
"
,
Description
=
"
Reacts on everyone or here mention?
"
,
Type
=
bot
.
ConfigType
.
Boolean
,
Default
=
true
}
}
end
function
Module
:
OnEnable
(
guild
)
local
config
=
self
:
GetConfig
(
guild
)
local
mentionEmoji
=
bot
:
GetEmojiData
(
guild
,
config
.
Emoji
)
if
(
not
mentionEmoji
)
then
return
false
,
"
Emoji
\"
"
..
config
.
Emoji
..
"
\"
not found (check your configuration)
"
end
return
true
end
function
Module
:
OnMessageCreate
(
message
)
if
(
not
bot
:
IsPublicChannel
(
message
.
channel
))
then
return
end
local
mention
=
false
local
config
=
self
:
GetConfig
(
message
.
guild
)
if
(
message
.
mentionsEveryone
and
config
.
ReactOnEveryoneOrHere
)
then
mention
=
true
else
for
_
,
user
in
pairs
(
message
.
mentionedUsers
)
do
if
(
user
.
id
==
client
.
user
.
id
)
then
mention
=
true
break
end
end
end
if
(
mention
)
then
local
mentionEmoji
=
bot
:
GetEmojiData
(
message
.
guild
,
config
.
Emoji
)
if
(
not
mentionEmoji
)
then
return
end
message
:
addReaction
(
mentionEmoji
.
Emoji
or
mentionEmoji
.
Id
)
end
end
Back
|
FazBrowse Home
|
New Git URL