mirror of
https://github.com/thedevs-network/the-guard-bot
synced 2025-08-31 22:25:15 +00:00
Always use first_name in link, and escape it
I'm disappointed that you added that to TODO instead of resolving it immiedetly, @poeti8. Also added escapeHtml, so the bot doesn't break when someone has something html-like in first_name.
This commit is contained in:
2
TODO.md
2
TODO.md
@@ -27,7 +27,7 @@
|
|||||||
- [ ] All command be available with both `!` and `/`.
|
- [ ] All command be available with both `!` and `/`.
|
||||||
- [x] Auto remove commands if they're not sent by admins.
|
- [x] Auto remove commands if they're not sent by admins.
|
||||||
- [x] Auto remove joining messages.
|
- [x] Auto remove joining messages.
|
||||||
- [ ] Use first name instead of username for link.
|
- [x] Use first name instead of username for link.
|
||||||
- [ ] Commands work with username too.
|
- [ ] Commands work with username too.
|
||||||
- [ ] Commands should tell which admin sent the command.
|
- [ ] Commands should tell which admin sent the command.
|
||||||
- [ ] Ban and remove Arabic/Russian/Indian text.
|
- [ ] Ban and remove Arabic/Russian/Indian text.
|
||||||
|
@@ -1,7 +1,10 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const link = ({ id, username, first_name }) =>
|
const escapeHtml = s => s
|
||||||
`<a href="tg://user?id=${id}">${username ? username : first_name}</a>`;
|
.replace(/</g, '<');
|
||||||
|
|
||||||
|
const link = ({ id, first_name }) =>
|
||||||
|
`<a href="tg://user?id=${id}">${escapeHtml(first_name)}</a>`;
|
||||||
|
|
||||||
const deleteAfter = ms => ctx =>
|
const deleteAfter = ms => ctx =>
|
||||||
setTimeout(() =>
|
setTimeout(() =>
|
||||||
|
Reference in New Issue
Block a user