Skip to content

Commit 417bbb1

Browse files
committed
members can use /user to get their status
1 parent 2870b7f commit 417bbb1

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

handlers/commands/user.js

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,14 @@ const { getUser, getWarns } = require('../../stores/user');
1111

1212
const getWarnsHandler = async ({ message, reply, state }) => {
1313
const { isAdmin } = state;
14-
if (!isAdmin) return null;
1514

1615
const mentionedUser = message.reply_to_message
1716
? message.reply_to_message.from
1817
: message.commandMention
1918
? message.commandMention
20-
: null;
21-
if (!mentionedUser) {
22-
return reply(
23-
'ℹ️ <b>Reply to a message or mention a user.</b>',
24-
replyOptions
25-
).then(scheduleDeletion);
26-
}
19+
: state.user;
20+
21+
if (!isAdmin && mentionedUser.id !== state.user.id) return null;
2722

2823
const theUser = await getUser({ id: mentionedUser.id });
2924

@@ -49,14 +44,14 @@ const getWarnsHandler = async ({ message, reply, state }) => {
4944
`${theUser.banReason}\n\n` +
5045
warnsMessage,
5146
replyOptions
52-
);
47+
).then(scheduleDeletion);
5348
}
5449

5550
return reply(
5651
`ℹ️ ${link(theUser)} <b>is a member of network.</b>\n\n` +
5752
warnsMessage,
5853
replyOptions
59-
);
54+
).then(scheduleDeletion);
6055
};
6156

6257
module.exports = getWarnsHandler;

0 commit comments

Comments
 (0)