Ban Reason show null or n/a in my Bot


#1

Hello everyone,

my english is very bad and for that i want to apologize first.
I hope you still understand me.

I want to intercept the ban reason about my bot.
But it always gets to me “null” in my DB or “n/a”.

I tried it with “/ban <username> <reason>” like this “/ban me_123_test this is a test”
My Bot is Mod and can Ban too. But don’t show my reason.

What is wrong ?

with friendly greetings from Germany


#2

When its a bot, from irc, command must start with “.”, not with “/”. Like “.ban me_123_test this is test”


#3

Thank you for your reply … this dosnt work too … Same problem :confused:

EDIT: My Code -
var tmi = require(‘tmi.js’);
var options = {
options: {
debug: true
},
connection: {
cluster: “aws”,
reconnect: true
},
identity: {
username: “BOT_NAME”,
password: “oauth:MY_PW”
},
channels: [“test_user”]
};
var client = new tmi.client(options);
client.connect();
client.on(“ban”, function (channel, username, reason) {
console.log("User " + username + " banned in " + channel + ". (Reason: " + reason + “)”);
});

Output: User test_123 banned in test_user. (Reason: null)


#4

Check out

I went digging, it got moved from TMI to PubSub.

Which be why it’s not in the docs either.

There is a discussion thread on the matter from 2016, which basically says “use pubsub”


#5

Hello BarryCarlyon,

thank you for your Reply… pubsub isn’t reachable at the link (404 - This is not the web page you are looking for.)
I try google with the query “pubsub” but was not successful. :roll_eyes:

I’m probably too stupid :thinking:


#6

PubSub is documented here:

The pubsub topic for moderation actions in the linked thread


#7

Holy moly … very fast reaction … thank you … I will read it to myself and contact again if I can not get any further


#8

The ban-reason tag was a month or two ago removed from IRC and the reason is right now only available via the above-mentioned pubsub topic.


#9

Hello, i have try to understand this “pubsub” but it’s for me a horror.
I want to understand it, but it does not work.

Can some one help me with a litle code for Ban Events?


#10

Hmm… ok no one can help ?


#11

Documentation is here:

PubSub is a industry stnadard communication method, so whichever programming language you prefer likely already has in implementation of PubSub as a library you can include.

I can’t just give you some code, without knowing a language preference or what you intended to then do with the collected information.


#12

Yea, i have try to understand this but its for me a horror. I want to understand it, but it does not work. I try to code in NodeJS a Bot for my Channel how can listen " .on(“ban”, …) " and insert this banned user in a DB with original ban reason.


#13

Well it sounds like your bot is already connected to TwitchChat over IRC.

So you will need to make a second connection to PubSub and then you will need to parse the response information pushed to you.