- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试将模式设置为 IRC channel ,但在主方法中调用时 PircBotX 似乎没有执行该命令。当我发送我在代码中设置的消息 (!setRModePlus) 时,该命令就会执行。我的代码哪里错了?
import org.pircbotx.Channel;
import org.pircbotx.Configuration;
import org.pircbotx.PircBotX;
import org.pircbotx.hooks.ListenerAdapter;
import org.pircbotx.hooks.types.GenericMessageEvent;
public class MyListener extends ListenerAdapter {
static Channel channel = null;
static PircBotX bot = null;
@Override
public void onGenericMessage(GenericMessageEvent event) {
if (event.getMessage().startsWith("!setRModePlus")) {
channel = bot.getUserChannelDao().getChannel("#mychannel");
channel.send().setMode("+R");
}
if (event.getMessage().startsWith("!setRModeMinus")) {
channel = bot.getUserChannelDao().getChannel("#mychannel");
channel.send().setMode("-R");
}
}
public static void main(String[] args) throws Exception {
//Configure the bot
Configuration configuration = new Configuration.Builder()
.setName("myname")
.addServer("myserver")
.setNickservPassword("mypassword")
.addAutoJoinChannel("#mychannel")
.addListener(new MyListener())
.buildConfiguration();
//Create bot with the configuration
bot = new PircBotX(configuration);
bot.startBot();
channel = bot.getUserChannelDao().getChannel("#mychannel");
channel.send().setMode("+R");
}
感谢您提供的任何帮助。对不起我的英语。
最佳答案
问题现已解决。我添加了 onConnect 方法并发送这样的命令
public void onConnect(ConnectEvent event) {
event.getBot().send().mode("#mychannel", "+R");
event.getBot().send().mode("#mychannel", "-R");
}
关于java - Pircbotx channel setMode() 在 main() 方法中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60791314/
我一直在努力编写一个脚本,该脚本将 Pi 的 BCM 引脚 17、27 和 10 打开 1 秒,然后关闭 1 秒,连续 100 次。当我运行脚本时,LED1 会亮起然后熄灭,程序因以下错误而关闭: T
我尝试在播放媒体时通过 setMode(mode_in_call) 更改音频模式。所以,我确定我添加了权限 我这样写代码:AudioManager mAudioManager = (AudioMana
为什么我无法调用setModal()方法? 我正在开发 GUI。我有两个 jframe。以下代码用于一个按钮,应该打开另一个框架。但我收到错误消息: cannot find method setMod
我试图将此 QT UI 设置为“无模态”,我尝试了 setModal(false),但不幸的是它不起作用。含义:它可以编译并运行,但我仍然无法让子 UI 和父 UI 并行工作。我正在使用 QT 4.8
本文整理了Java中am.widget.zxingscanview.ZxingForegroundView.setMode()方法的一些代码示例,展示了ZxingForegroundView.setM
我想让 i 使得子窗口处于 Activity 状态时无法访问父窗口。我正在使用 JDialog 类的 .setModal() 方法,但它似乎不起作用。 if (clickEvent.getSou
我正在开发 2 个需要协同工作的 VoIP 应用程序;一个是软电话应用程序(应用程序 A),它使用预期的各种音频模式,即 RINGTONE、IN_COMMUNICATION 等。另一个应用程序(应用程
即使打开耳机,我也试图在扬声器上播放声音,但如果背景中有音乐播放,我希望在耳机上播放音乐直到播放声音。 所以我正在采取接下来的步骤: 在我播放声音之前,我获得了 audioFocus 所以所有的背景音
我正在研究 AudioManager,它是一个 Android 系统服务。对于 Android System 5.0+,我遇到了 AudioManager 的 setMode 方法不起作用的问题。 我
本文整理了Java中com.jme3.scene.debug.WireBox.setMode()方法的一些代码示例,展示了WireBox.setMode()的具体用法。这些代码示例主要来源于Githu
本文整理了Java中org.apache.openjpa.persistence.XMLPersistenceMetaDataSerializer.setMode()方法的一些代码示例,展示了XMLP
本文整理了Java中org.apache.openjpa.persistence.XMLPersistenceMetaDataParser.setMode()方法的一些代码示例,展示了XMLPersi
我正在尝试将模式设置为 IRC channel ,但在主方法中调用时 PircBotX 似乎没有执行该命令。当我发送我在代码中设置的消息 (!setRModePlus) 时,该命令就会执行。我的代码哪
我在一个只执行音频播放的应用程序中使用 AVAudioSession。我正在 applicationDidFinishLaunchingWithOptions: 中设置 audioSession 的模
我正在 Linux 上移植一个 WIN32 库。我能够毫无错误地编译我的库。但是当我尝试链接时,它给出了以下链接错误 undefined reference to `setmode' 我知道 setm
本文整理了Java中us.ihmc.robotics.math.functionGenerator.YoFunctionGenerator.setMode()方法的一些代码示例,展示了YoFuncti
我想添加三次折线图。我已经提交了这个答案:How to enable cubic lines in MPAndroidChart library?但解决方案不起作用。有什么解决办法吗?我有 Mp An
当我设置第一个 JDialog 模态和第二个非模态时,我遇到了问题。 这是我要实现的功能: 点击“测试对话框!”按钮,一个名为 Custom Dialog 的 JDialogMain 将打开。 如果在
我尝试打印 unicode 的是 _setmode(_fileno(stdout), _O_U8TEXT); string str = u8"unicode 한글 hangul"; cout u8o
我正在使用使用AudioManager更改音频状态的应用程序。当应用程序处于后台时,将模式更改回正常状态时,应用程序崩溃。 这是设备特定的问题。该应用仅在后台运行时,仅在具有Android 8.0或A
我是一名优秀的程序员,十分优秀!