其他用户能在Hexchat中看到Python的打印语句吗?

3
使用基于xchat的hexchat与python脚本编程。
阅读API文档后,我不确定其他用户是否可以看到打印语句。那么其他频道中的用户能否看到以下内容,或者只有我自己能看到:
import hexchat
hexchat.prnt("Hi everyone!")

使用Python的print怎么样?

import hexchat
print("Hi everyone!")

编辑

我猜这个问题的推论是如何发送聊天消息,以便其他用户可以看到它。


1
不应该,print 输出到 STDOUT,而 hexchat 输出到服务器的套接字。 - bheklilr
2个回答

8

hexchat.prntprint的作用相同,都会在你的客户端上显示一条消息,但这些消息不会发送到服务器,只有你自己能看见。

如果要将消息发送给服务器,请使用以下方法之一:

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

或者

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

将<#channel/user>替换为你的信息目标,两者的差异在于前者会在客户端中显示消息,而后者则会静默发送消息,不会通知脚本用户。


1

我不确定是否有更好的方法来做这件事,但我所做的是。

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

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接