message: Record user activity only when they visibly communicate with a room
diff: @@ -178,8 +178,6 @@ export class DiscordBot {
  public GetIntentFromDiscordMember(member: Discord.GuildMember | Discord.PartialUser | Discord.User,
  webhookID: string|null = null): Intent {
  - let intent: Intent;
  -
  if (webhookID) {
  // webhookID and user IDs are the same, they are unique, so no need to prefix _webhook_
  const name = member instanceof Discord.GuildMember ? member.user.username : member.username;
  @@ -188,13 +186,9 @@ export class DiscordBot {
  throw Error("Couldn't get intent for Discord member, name was null");
  }
  // TODO: We need to sanitize name
  - intent = this.bridge.getIntentForSuffix(`${webhookID}_${Util.EscapeStringForUserId(name)}`);
  - } else {
  - intent = this.bridge.getIntentForSuffix(member.id);
  + return this.bridge.getIntentForSuffix(`${webhookID}_${Util.EscapeStringForUserId(name)}`);
  }
  -
  - this.userActivity.updateUserActivity(intent.userId);
  - return intent;
  + return this.bridge.getIntentForSuffix(member.id);
  }
  public async init(): Promise<void> {
  @@ -912,6 +906,7 @@ export class DiscordBot {
  msgID: string): Promise<boolean> {
  const rooms = await this.channelSync.GetRoomIdsFromChannel(chan);
  const intent = this.GetIntentFromDiscordMember(author);
  + this.userActivity.updateUserActivity(intent.userId);
  await Util.AsyncForEach(rooms, async (roomId) => {
  const eventId = await intent.sendEvent(roomId, {
  @@ -938,6 +933,7 @@ export class DiscordBot {
  try {
  const intent = this.GetIntentFromDiscordMember(user);
  await intent.ensureRegistered();
  + this.userActivity.updateUserActivity(intent.userId);
  await Promise.all(rooms.map( async (roomId) => {
  return intent.underlyingClient.setTyping(roomId, isTyping);
  }));
  @@ -1008,6 +1004,7 @@ export class DiscordBot {
  }
  try {
  const intent = this.GetIntentFromDiscordMember(msg.author, msg.webhookID);
  + this.userActivity.updateUserActivity(intent.userId);
  // Check Attachements
  if (!editEventId) {
  // on discord you can't edit in images, you can only edit text
  @@ -1153,6 +1150,7 @@ export class DiscordBot {
  log.info(`Deleting discord msg ${storeEvent.DiscordId}`);
  const intent = this.GetIntentFromDiscordMember(msg.author, msg.webhookID);
  await intent.ensureRegistered();
  + this.userActivity.updateUserActivity(intent.userId);
  const matrixIds = storeEvent.MatrixId.split(";");
  try {
  await intent.underlyingClient.redactEvent(matrixIds[1], matrixIds[0]);
  