3

Using hexchat (which is based on xchat) with python scripting.

Reading the API docs it's not clear to me if other users can see print statements. So can other users in a channel see the following or is it only visible to me:

import hexchat
hexchat.prnt("Hi everyone!")

what about using python's print?

import hexchat
print("Hi everyone!")

EDIT

I guess the corollary to this question would be how to send a chat message so that other users could see it.

User
  • 62,498
  • 72
  • 186
  • 247

2 Answers2

8

Both hexchat.prnt and print do the same thing, display a message in your client that is not sent to the server. Only you will see these.

To send a message to the server, use either

hexchat.command("say <message>") # Uses hexchat's /say command, sends in current channel's context

or

hexchat.command("PRIVMSG <#channel/user> :<message>") # Uses the raw IRC command, send to any channel

(Replace with your message and <#channel/user> with the target message target)

The difference between the two is that the former also displays the message in the client, while the latter send the message silently without informing the user of the script.

3ventic
  • 1,023
  • 1
  • 20
  • 32
1

I am not sure if there is a better way to do it, but what I do is.

import hexchat
hexchat.command("say Hi everyone!")