Getting Error no response from twitch

My bot works on default messages like hi in chat but when i try to ban someone it gives me the error no response from twitch

client.on('message', ( channel, context, message, self) => {
const lowercaseMessage = message.toLowerCase();
for (const blockedWord of blockedWords) {
    if (lowercaseMessage.includes(blockedWord)) {
        client.ban(channel,context.username, "Inappropriate language detected")
        .catch((err) => {
            console.error('Error timing out user:', err);

Commands over IRC have been deprecated for over a year now,

If you want to ban a user, you’ll need to use the Ban User API endpoint. Same with most other commands that were previously handled through IRC they’re now done through the API.

Ok thanks that i understand but is there an example that i can follow for nodejs how to implement this?

assuming usage of fetch

        let url = new URL(''); = new URLSearchParams([
            ['broadcaster_id', broadcaster_id],
            ['moderator_id', this._userId]

        let ban_user_response = await fetch(
                method: 'POST',
                headers: {
                    'Client-ID': this.client_id,
                    'Authorization': `Bearer ${this.access_token}`,
                    'Content-Type': 'application/json'
                body: JSON.stringify({
                  data: {
                      duration: duration,