• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java EventDispatcher类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中sx.blah.discord.api.events.EventDispatcher的典型用法代码示例。如果您正苦于以下问题:Java EventDispatcher类的具体用法?Java EventDispatcher怎么用?Java EventDispatcher使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



EventDispatcher类属于sx.blah.discord.api.events包,在下文中一共展示了EventDispatcher类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: run

import sx.blah.discord.api.events.EventDispatcher; //导入依赖的package包/类
@Override
public void run(String... arg0) throws Exception
{   
    IDiscordClient client;
    ClientBuilder clientBuilder = new ClientBuilder();
    clientBuilder.withToken(token);

    try
    {
        client = clientBuilder.login();
        
        EventDispatcher dispatcher = client.getDispatcher();
        dispatcher.registerListener(new LeaderboardDiscordActions(client, prefix, leaderboardDao, leaderboardColumnDao));
    }
    catch (DiscordException e)
    {
        e.printStackTrace();
        System.exit(0);
    }
}
 
开发者ID:Vyserion,项目名称:lodbot,代码行数:21,代码来源:Bot.java


示例2: start

import sx.blah.discord.api.events.EventDispatcher; //导入依赖的package包/类
void start(String[] args) {
	if(!loadProperties()) {
		logger.error("Error loading properties. Make sure Bot.properties exists");
		System.exit(0);
	}
	bot = getClient(secret);
	// This makes the prune command a bit better on startup, but might mess with memory usage
	// when server count gets high
	MessageList.setEfficiency(bot, EfficiencyLevel.NONE);
	EventDispatcher dispatcher = bot.getDispatcher();
	dispatcher.registerListener(new AudioListeners());
	dispatcher.registerListener(new VoiceChannelListeners());
	dispatcher.registerListener(new ModLogListeners());
	dispatcher.registerListener(new Listeners());
	dispatcher.registerListener(new AdvancedLogListeners());
	JobScheduler.initializeScheduler();
}
 
开发者ID:paul-io,项目名称:momo-discord-old,代码行数:18,代码来源:Bot.java


示例3: main

import sx.blah.discord.api.events.EventDispatcher; //导入依赖的package包/类
public static void main(String[] args) throws OAuthException {
    IDiscordClient client = Discord.createClient(Keys.DiscordBotToken, true);
    EventDispatcher dispatcher = client.getDispatcher(); // Gets the EventDispatcher instance for this client instance
    dispatcher.registerListener(new InterfaceListener()); // Registers the IListener example class from above
    CommandHandler handler = new Discord4JHandler(client);
    handler.setDefaultPrefix("~");
    handler.registerCommand(new PastaCommand());
    handler.registerCommand(new JokeCommand());
    handler.registerCommand(new KahootCommand());
    handler.registerCommand(new HelpCommand(handler));
}
 
开发者ID:nbd9,项目名称:PastaBot,代码行数:12,代码来源:Main.java


示例4: start0

import sx.blah.discord.api.events.EventDispatcher; //导入依赖的package包/类
private void start0() {
	
	EventDispatcher dispatcher = getClient().getDispatcher();

	Set<Listener> listeners = library.getListeners();

	if(listeners == null || listeners.isEmpty()) {
		LOGGER.info("No listeners found.. This bot will not do anything");
	}
	for(Listener l : listeners) {
		dispatcher.registerListener(l);
		LOGGER.info("Registered Listener --> {}", l.getName());
	}
}
 
开发者ID:cool-mist,项目名称:DiscordConvenienceBot,代码行数:15,代码来源:DiscordBot.java


示例5: IListenerAdaptor

import sx.blah.discord.api.events.EventDispatcher; //导入依赖的package包/类
IListenerAdaptor(EventDispatcher dispatcher) {
	this.dispatcher = dispatcher;
	dispatcher.registerListener(new IListener() {
		@Override
		public void handle(Event event) {
			emitters.forEach(emitter -> emitter.onNext(event));
		}
	});
}
 
开发者ID:Discord4J-Addons,项目名称:D4J-Rx,代码行数:10,代码来源:RxJavaEventAdapter.java


示例6: IListenerAdaptor

import sx.blah.discord.api.events.EventDispatcher; //导入依赖的package包/类
IListenerAdaptor(EventDispatcher dispatcher) {
	this.dispatcher = dispatcher;
	dispatcher.registerListener(new IListener() {
		@Override
		public void handle(Event event) {
			sinks.forEach(sink -> sink.next(event));
		}
	});
}
 
开发者ID:Discord4J-Addons,项目名称:D4J-Rx,代码行数:10,代码来源:ReactorEventAdapter.java


示例7: initDiscord

import sx.blah.discord.api.events.EventDispatcher; //导入依赖的package包/类
public void initDiscord(){
    //Init lavaplayer
    Karren.log.info("Starting up Lavaplayer...");
    gms = new HashMap<>();
    AudioSourceManagers.registerRemoteSources(pm);
    AudioSourceManagers.registerLocalSource(pm);
    //Continue connecting to discord
    if(Karren.conf.getConnectToDiscord()) {
        EventDispatcher ed = client.getDispatcher();
        ed.registerListener(new ConnectCommand());
        try {
            client.login();
        } catch (DiscordException | RateLimitException e) {
            e.printStackTrace();
        }
        ed.registerListener(new HelpCommand());
        ed.registerListener(interactionListener);
        ed.registerListener(new KillCommand());
        ed.registerListener(new GuildCreateListener());
        ed.registerListener(new ShutdownListener());
        ed.registerListener(new ReconnectListener());
        ed.registerListener(new StatCommand());
        initExtras();
    } else {
        Karren.log.info("Running in test mode, not connected to Discord.");
        initExtras();
        //Init interaction processor

    }
}
 
开发者ID:ripxfrostbite,项目名称:karren-sama,代码行数:31,代码来源:KarrenBot.java


示例8: main

import sx.blah.discord.api.events.EventDispatcher; //导入依赖的package包/类
public static void main(String[] args) throws IOException {
       //Get bot settings
	Properties p = new Properties();
	p.load(new FileReader(new File("settings.properties")));
	BotSettings.init(p);

	client = createClient(BotSettings.TOKEN.get());
       if (client == null)
           throw new NullPointerException("Failed to log in! Client cannot be null!");

	UpdateListData.init();

	Authorization.getAuth().init();

       //Connect to MySQL
	DatabaseManager.getManager().connectToMySQL();
       DatabaseManager.getManager().createTables();

	//Start spark (catch any issues from it so only the site goes down without affecting bot....
	try {
		SparkUtils.initSpark();
	} catch (Exception e) {
		ExceptionHandler.sendException(null, "'Spark ERROR' by 'PANIC! AT THE WEBSITE'", e, Main.class);
	}

       //Register events
       EventDispatcher dispatcher = client.getDispatcher();
       dispatcher.registerListener(new ReadyEventListener());

       //Register modules
       CommandExecutor executor = CommandExecutor.getExecutor().enable();
       executor.registerCommand(new HelpCommand());
       executor.registerCommand(new DisCalCommand());
       executor.registerCommand(new CalendarCommand());
       executor.registerCommand(new AddCalendarCommand());
       executor.registerCommand(new LinkCalendarCommand());
       executor.registerCommand(new TimeCommand());
       executor.registerCommand(new EventListCommand());
       executor.registerCommand(new EventCommand());
       executor.registerCommand(new RsvpCommand());
       executor.registerCommand(new AnnouncementCommand());
       executor.registerCommand(new DevCommand());

	//Load language files.
	MessageManager.loadLangs();

	//Accept commands
	ConsoleCommandExecutor.init();
}
 
开发者ID:NovaFox161,项目名称:DisCal-Discord-Bot,代码行数:50,代码来源:Main.java


示例9: enable

import sx.blah.discord.api.events.EventDispatcher; //导入依赖的package包/类
/**
 * Enables the CommandExecutor and sets up the Listener.
 * @return The CommandExecutor's instance.
 */
public CommandExecutor enable() {
    EventDispatcher dispatcher = Main.client.getDispatcher();
    dispatcher.registerListener(new CommandListener(this));
    return instance;
}
 
开发者ID:NovaFox161,项目名称:DisCal-Discord-Bot,代码行数:10,代码来源:CommandExecutor.java


示例10: DefaultEventAdapter

import sx.blah.discord.api.events.EventDispatcher; //导入依赖的package包/类
DefaultEventAdapter(EventDispatcher dispatcher) {
	this.dispatcher = dispatcher;
}
 
开发者ID:Discord4J-Addons,项目名称:D4J-Rx,代码行数:4,代码来源:IEventAdapter.java


示例11: PublisherListener

import sx.blah.discord.api.events.EventDispatcher; //导入依赖的package包/类
PublisherListener(EventDispatcher dispatcher, Class<E> clazz) {this.dispatcher = dispatcher;
	this.clazz = clazz;
}
 
开发者ID:Discord4J-Addons,项目名称:D4J-Rx,代码行数:4,代码来源:IEventAdapter.java


示例12: RxJavaEventAdapter

import sx.blah.discord.api.events.EventDispatcher; //导入依赖的package包/类
public RxJavaEventAdapter(EventDispatcher dispatcher) {
	this.dispatcher = dispatcher;
	eventFlowable = Flowable.create(new IListenerAdaptor(dispatcher), BackpressureStrategy.BUFFER);
}
 
开发者ID:Discord4J-Addons,项目名称:D4J-Rx,代码行数:5,代码来源:RxJavaEventAdapter.java


示例13: ReactorEventAdapter

import sx.blah.discord.api.events.EventDispatcher; //导入依赖的package包/类
public ReactorEventAdapter(EventDispatcher dispatcher) {
	this.dispatcher = dispatcher;
	flux = Flux.create(new IListenerAdaptor(dispatcher), FluxSink.OverflowStrategy.BUFFER);
}
 
开发者ID:Discord4J-Addons,项目名称:D4J-Rx,代码行数:5,代码来源:ReactorEventAdapter.java


示例14: newDefaultAdapter

import sx.blah.discord.api.events.EventDispatcher; //导入依赖的package包/类
/**
 * This generates an implementation of {@link IEventAdapter} using only default Reactive Streams interfaces.
 * This is not recommended! Use a proper implementation like for RxJava or Reactor.
 * 
 * @param dispatcher The dispatcher to wrap.
 * @return The new adapter.
 */
static IEventAdapter newDefaultAdapter(EventDispatcher dispatcher) {
	return new DefaultEventAdapter(dispatcher);
}
 
开发者ID:Discord4J-Addons,项目名称:D4J-Rx,代码行数:11,代码来源:IEventAdapter.java



注:本文中的sx.blah.discord.api.events.EventDispatcher类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java SignerInfoGenerator类代码示例发布时间:2022-05-22
下一篇:
Java DelegateInvocationHandlerImpl类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap