Hello 
I may have followed the documentation concerning the TMI to the letter. The username I enter is never the one used to write in the channel chat.
The name displayed is that of the user who used to generate the Oauth token. What is the username subfield of the identity field for?
Thank you in advance for your reply 
In order to connect/send to chat as userX you must have a valid user token of userX.
So userX must have gone thru the oAuth flow and you must use the token for userX.
This isn’t “incorrect”
Just TMI ignored the username and used the username from the oAuth token
Oh ok, that’s what it seemed to me.
So if I want to speak on behalf of a bot in the TMI, can’t I? Exist as a bot on the channel and take action on its behalf?
No you need to login to TMI as the Bot.
You cannot login as you are send messages as someone else
So I see I have to create a separate twitch account, add it as a moderator on the channel in question, generate its access token and then use it in the TMI?
But it is against intuitive in this not to be able to also use it in the subscription has PUB / SUB, where there it is necessary on the other hand the identity and therefore the access_token of the owner of the channel.
It’s complicated …
Yes
The bot uses the a token that represents the bot, that has chat read/write
And to read from pubsub, you use a token that represents you, and has the subscribe scopes (or whatever you need for whichever topics)
My problem it’s i want to use pub/sub for detect for example, the custom reward system, and take action as a bot on the channel…
So i need to develop a programm with two authentification separatly
then you need two tokens
One for the bot with the chat scopes
One for you that has the redemptions scopes