Add support for bot mode

References: https://ircv3.net/specs/extensions/bot-mode
This commit is contained in:
Simon Ser 2022-06-08 15:04:27 +02:00
parent 8507500d74
commit 6b04cb1417
3 changed files with 12 additions and 0 deletions

View file

@ -189,6 +189,10 @@ export default function BufferHeader(props) {
let desc = "This user is a server operator, they have administrator privileges."; let desc = "This user is a server operator, they have administrator privileges.";
details.push(html`<abbr title=${desc}>server operator</abbr>`); details.push(html`<abbr title=${desc}>server operator</abbr>`);
} }
if (props.user.bot) {
let desc = "This user is an automated bot.";
details.push(html`<abbr title=${desc}>bot</abbr>`);
}
details = details.map((item, i) => { details = details.map((item, i) => {
if (i === 0) { if (i === 0) {
return item; return item;

View file

@ -474,6 +474,10 @@ export class Isupport {
} }
return chanModes; return chanModes;
} }
bot() {
return this.raw.get("BOT");
}
} }
export const CaseMapping = { export const CaseMapping = {

View file

@ -454,6 +454,10 @@ export const State = {
if (who.flags !== undefined) { if (who.flags !== undefined) {
who.away = who.flags.indexOf("G") >= 0; // H for here, G for gone who.away = who.flags.indexOf("G") >= 0; // H for here, G for gone
who.operator = who.flags.indexOf("*") >= 0; who.operator = who.flags.indexOf("*") >= 0;
let botFlag = client.isupport.bot();
if (botFlag) {
who.bot = who.flags.indexOf(botFlag) >= 0;
}
delete who.flags; delete who.flags;
} }