message: Make sure the bridge doesn't crash (and crashloop) it the token is invalid
diff: @@ -214,20 +214,34 @@ async function run(): Promise<void> {
  roomhandler.bindThirdparty();
  + try {
  + await startDiscordBot(discordbot);
  + log.info("Discordbot started successfully");
  + } catch (err) {
  + log.error(err);
  + log.error("Failure during startup. Exiting");
  + process.exit(1);
  + }
  +
  await appservice.begin();
  log.info(`Started listening on port ${port}`);
  +}
  +
  +async function startDiscordBot(discordbot: DiscordBot, falloffSeconds = 5) {
  try {
  await discordbot.init();
  await discordbot.run();
  - log.info("Discordbot started successfully");
  } catch (err) {
  - log.error(err);
  - log.error("Failure during startup. Exiting");
  - process.exit(1);
  + // no more than 5 minutes
  + const newFalloffSeconds = Math.min(falloffSeconds * 2, 5 * 60);
  + log.error(`Failed do start Discordbot: ${err.code}. Will try again in ${newFalloffSeconds} seconds`);
  + await new Promise((r, _) => setTimeout(r, newFalloffSeconds * 1000));
  + return startDiscordBot(discordbot, newFalloffSeconds);
  }
  }
  +
  run().catch((err) => {
  log.error("A fatal error occurred during startup:", err);
  process.exit(1);
  