if let Some(mentions) = message.mentions() {
let client = get_client().unwrap();
let self_id = client.user_id().unwrap();
if mentions.user_ids.iter().any(|x|x == self_id) {
let color = vec3(0.9, 0.9, 0.1);
item.apply_over(cx, live!(
draw_bg: {
color: (color)
}
));
item.redraw(cx);
log!("{} mentioned me!", event_tl_item.sender())
}
}
These possess two functionality:
UserId
was mentioned, apply_over
this message’s bg to yellow.UserId
of this message.// fn pixel(self) -> vec4 {
// return mix(
// mix(
// #ffffff,
// #fafafa,
// self.hover
// ),
// #c5d6fa, // light blue
// self.highlight
// )
// }
color: #F9F9F9
Replace func pixel
with a fixed color #F9F9F9
.
If you do not comment out func pixel
, func apply_over
will not work.
Upon completion of the above two changes, run robrix, then you will find out not all the message that mentioned yourself is yellow. I have debugged this all day, and don’t why this is.
Some pictures for message of mentioned self highlight, it’s random, IMHO: