tmijs / tmi.js

💬 Javascript library for the Twitch Messaging Interface. (Twitch.tv)
https://tmijs.com
MIT License
1.54k stars 216 forks source link

Messages not showing in chat #454

Closed CaiIsProgrammer closed 2 years ago

CaiIsProgrammer commented 3 years ago

Actual behaviour: I am seeing chats in the console with debug mode on. Though the chats are NOT showing up in the stream chat.

Expected behaviour: Working like before to where chats are showing up.

Error log:

Insert your error log here

Server configuration

code:


  const client = new tmi.Client({
    options: { debug: true },
    connection: {
      secure: true,
      reconnect: true,
    },
    identity: {
      username: "Twitchtranslatebot",
      password: "",
    },
    channels: [name],
  });

  client.connect();

  client.on("error", (data) => {
    console.log(data);
  });

  client.on("message", async (channel, tags, message, self) => {
    try {
      // Ignore echoed messages.
      if (self) return;
      Translate(message.toLowerCase(), { to: lang })
        .then((res) => {
          if (res.text.toLowerCase().trim() === message.toLowerCase().trim()) {
            console.log("same same");
            return;
          }
          client.say(channel, `@${tags.username} ${res.text}`);
        })
        .catch((err) => {
          console.error(err);
        });
    } catch (error) {
      console.log(error);
    }
  });
};```
DrTHC commented 1 year ago

I'm having an identical issue. No matter what I do tmi will not broadcast to the chat unless the command is written within a If Statement. I'm really not sure what to do! The debug console writes the console.log("") but doesn't broadcast to chat.