Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Weasht
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
Emir Hamza
Weasht
Commits
b9e4053f
Commit
b9e4053f
authored
Jan 18, 2021
by
Reviath
Browse files
Options
Downloads
Patches
Plain Diff
added mute, unmute, add-emote commands
parent
8f465099
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
commands/add-emote.js
+36
-0
36 additions, 0 deletions
commands/add-emote.js
commands/mute.js
+55
-0
55 additions, 0 deletions
commands/mute.js
commands/unmute.js
+26
-0
26 additions, 0 deletions
commands/unmute.js
with
117 additions
and
0 deletions
commands/add-emote.js
0 → 100644
+
36
−
0
View file @
b9e4053f
const
Discord
=
require
(
"
discord.js
"
);
exports
.
run
=
async
(
client
,
message
,
args
)
=>
{
var
url
=
""
;
var
name
=
""
;
if
(
!
message
.
member
.
hasPermission
(
"
MANAGE_EMOJIS
"
))
return
[
message
.
channel
.
send
(
`You must have
\`
MANAGE_EMOJIS
\`
permission to perform this action.`
)];
let
emoji
=
args
[
0
];
var
emojiid
=
emoji
.
match
(
/
\d
/g
);
emojiid
=
emojiid
.
join
(
""
);
var
emote
=
Discord
.
Util
.
parseEmoji
(
emoji
);
if
(
emote
.
animated
===
true
)
{
url
=
`https://cdn.discordapp.com/emojis/
${
emojiid
}
.gif`
;
}
if
(
emote
.
animated
===
false
)
{
url
=
`https://cdn.discordapp.com/emojis/
${
emojiid
}
.png`
;
}
if
(
!
args
[
1
])
{
name
=
emote
.
name
;
}
else
{
name
=
args
[
1
];
}
message
.
guild
.
emojis
.
create
(
url
,
name
)
.
then
((
emoji
)
=>
message
.
channel
.
send
(
`Created new emoji called
\`
${
emoji
.
name
}
\`
. Preview:
${
emoji
}
`
)
)
.
catch
(
console
.
error
);
};
module
.
exports
.
help
=
{
name
:
"
add-emoji
"
,
aliases
:
[
"
ae
"
,
"
emoji
"
,
"
add-emote
"
,
"
addemote
"
],
};
This diff is collapsed.
Click to expand it.
commands/mute.js
0 → 100644
+
55
−
0
View file @
b9e4053f
const
Discord
=
require
(
'
discord.js
'
);
const
ms
=
require
(
"
ms
"
);
exports
.
run
=
async
(
client
,
message
,
args
)
=>
{
let
spammer
=
message
.
guild
.
member
(
message
.
mentions
.
users
.
first
()
||
message
.
guild
.
members
.
cache
.
get
(
args
[
0
]));
if
(
!
spammer
)
return
message
.
channel
.
send
(
"
Please specify user to perform action upon.
"
);
if
(
!
message
.
member
.
hasPermission
(
"
MANAGE_MESSAGES
"
))
return
message
.
reply
(
"
Lacking permission to perform such action.
"
);
let
role
=
message
.
guild
.
roles
.
cache
.
find
(
r
=>
r
.
name
===
"
Muted
"
);
if
(
!
role
){
try
{
role
=
await
message
.
guild
.
roles
.
create
({
data
:{
name
:
"
Muted
"
,
color
:
"
#818080
"
,
permissions
:[]}
})
message
.
guild
.
channels
.
cache
.
forEach
(
async
(
channel
,
id
)
=>
{
await
channel
.
updateOverwrite
(
role
,
{
SEND_MESSAGES
:
false
,
ADD_REACTIONS
:
false
});
});
}
catch
(
e
){
console
.
log
(
e
.
stack
);
}
}
if
(
spammer
.
roles
.
cache
.
has
(
role
.
id
))
return
message
.
channel
.
send
(
'
User is already muted.
'
);
let
time
=
args
[
1
];
if
(
!
time
)
{
time
=
"
24h
"
};
let
reason
=
args
.
slice
(
2
).
join
(
'
'
);
if
(
!
reason
)
{
reason
=
"
Unspecified
"
}
await
(
spammer
.
roles
.
add
(
role
.
id
));
await
message
.
channel
.
send
(
`Muted User: <@
${
spammer
.
id
}
> \nDuration:
\`
${
ms
(
ms
(
time
))}
\`
\nReason:
\`
${
reason
}
\`
`
);
setTimeout
(
function
()
{
if
(
!
spammer
.
roles
.
cache
.
has
(
role
.
id
))
return
;
spammer
.
roles
.
remove
(
role
.
id
);
message
.
channel
.
send
(
`<@
${
spammer
.
id
}
> can speak again.`
);
},
ms
(
time
));
};
module
.
exports
.
help
=
{
name
:
'
mute
'
,
aliases
:
[
`tempmute`
]
};
This diff is collapsed.
Click to expand it.
commands/unmute.js
0 → 100644
+
26
−
0
View file @
b9e4053f
const
Discord
=
require
(
'
discord.js
'
);
const
ms
=
require
(
"
ms
"
);
exports
.
run
=
async
(
client
,
message
,
args
,
connection
)
=>
{
if
(
message
.
member
.
hasPermission
(
"
MANAGE_ROLES
"
)){
let
spammer
=
message
.
guild
.
member
(
message
.
mentions
.
users
.
first
()
||
message
.
guild
.
members
.
get
(
args
[
0
]));
let
role
=
message
.
guild
.
roles
.
cache
.
find
(
r
=>
r
.
name
===
"
Muted
"
);
if
(
!
role
)
return
;
if
(
!
spammer
.
roles
.
cache
.
has
(
role
.
id
))
return
message
.
channel
.
send
(
'
User is not muted.
'
);
spammer
.
roles
.
remove
(
role
.
id
);
message
.
channel
.
send
(
`<@
${
spammer
.
id
}
> can speak again.`
);
}
else
{
message
.
channel
.
send
(
`Lacking permission to perform such action.`
)
}
};
module
.
exports
.
help
=
{
name
:
'
unmute
'
,
aliases
:
[
'
um
'
]
};
\ No newline at end of file
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