sayonari / twitchTransFreeNext

MIT License
222 stars 104 forks source link

emotions and nicknames translating #27

Open artstylee opened 3 years ago

artstylee commented 3 years ago
  1. when you mention someone @nickname without a message the bot thinks that it is ENGLISH and trying to translate the nickname. is that possible to not translate nicknames. at least with empty messages?
  2. when people spam with emotions and smiles the bot is trying to translate it. i solved it by setting to ignore empty language ' ' but not sure if that is a right solution
artstylee commented 3 years ago

and bot is going down every 5 minutes when no one text in the chat. is that possible to update the bot every 5 min so it will not fall (auto disconnect from twitch)

didotb commented 3 years ago

based on the Twitch API, the usernames/nicknames are part of the raw_data attribute of the Message class, and so is the actual message. It is virtually impossible to tell them apart. Unless Twitch Username database is queried, which in this case would make this app a lot heavier on systems as well as the user's internet (it would query each word to see if that word is a username or not). Not to mention I believe that would upset Twitch Staff.

TwitchのAPIによると、ユーザー名/ニックネームは、Messageクラスのraw_data属性の一部であり、実際のメッセージも同様です。これらを見分けることは事実上不可能です。Twitchのユーザー名データベースにクエリをかけない限り、この場合、このアプリはユーザーのインターネットだけでなく、システムにも大きな負担をかけることになります(各単語がユーザー名であるかどうかをクエリすることになります)。言うまでもなく、それはTwitchのスタッフを怒らせると思います。

#

CLARIFICATION (明確化)

Twitch will be upset by how much query you're doing over an extremely short period of time, most likely the bot will not be able to access Twitch API for a certain period of time.

Twitchは、あなたが極めて短い期間に行っているクエリの量に動揺し、ほとんどの場合、ボットは一定期間Twitch APIにアクセスできなくなります。

-- Translated with DeepL -- DeepL で翻訳されています。

kenfehling commented 3 years ago

Maybe it can be guessed if a word is a username or not by the presence of underscores, numbers, etc. Also does the '@' appear as part of it?

didotb commented 3 years ago

if the message does contain the @ tag before the username then maybe you can add a few lines in the code if you're comfortable with that. You can use the line 246 in twitchTransFN.py file as a reference in what you should do. Basically detect the @ character using startswith(), then replacing it with nothing.