Ban Reason show null or n/a in my Bot

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

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

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.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)

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”

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:

PubSub is documented here:

The pubsub topic for moderation actions in the linked thread

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

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.

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?

Hmm… ok no one can help ?

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.

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.

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.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.