当前位置: 首页>>代码示例>>Java>>正文


Java MessageEvent.getTimestamp方法代码示例

本文整理汇总了Java中org.pircbotx.hooks.events.MessageEvent.getTimestamp方法的典型用法代码示例。如果您正苦于以下问题:Java MessageEvent.getTimestamp方法的具体用法?Java MessageEvent.getTimestamp怎么用?Java MessageEvent.getTimestamp使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.pircbotx.hooks.events.MessageEvent的用法示例。


在下文中一共展示了MessageEvent.getTimestamp方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getPreviousHourMessages

import org.pircbotx.hooks.events.MessageEvent; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public List<EventLog> getPreviousHourMessages(MessageEvent<MyPircBotX> event, int qty) {
	List<EventLog> results = new ArrayList<EventLog>();
	try{
		Criteria c = getSession().createCriteria(EventLog.class);
		c.add(Restrictions.like("channel", event.getChannel().getName()));
		c.add(Restrictions.like("nick", event.getUser().getNick()));
		Timestamp start = new Timestamp(event.getTimestamp()-QueryBO.HOUR);
		c.add(Restrictions.gt("sqltimestamp", (start)));
		c.addOrder(Order.desc("sqltimestamp"));
		c.setMaxResults(qty+1);//We need to see if there's *more* than the threshold
		results = c.list();
	}catch(Exception e){
		e.printStackTrace();
	}finally{
		close();
	}
	return results;
}
 
开发者ID:AndrewBell,项目名称:RCbot,代码行数:20,代码来源:QueryDAOImpl.java

示例2: getPeriodsAgo

import org.pircbotx.hooks.events.MessageEvent; //导入方法依赖的package包/类
public Timestamp getPeriodsAgo(int timeQuantity, String timePeriod, MessageEvent<MyPircBotX> event) {
	String search = stripTimePeriod(timePeriod);
	switch(search){
	case "hour":
		return new Timestamp(event.getTimestamp()-(HOUR*timeQuantity));
	case "day":
		return new Timestamp(event.getTimestamp()-(DAY*timeQuantity));
	case "week":
		return new Timestamp(event.getTimestamp()-(WEEK*timeQuantity));
	case "month":
		return new Timestamp(event.getTimestamp()-(MONTH*timeQuantity));
	case "year":
		return new Timestamp(event.getTimestamp()-(YEAR*timeQuantity));
	default:
		return null;
	}
}
 
开发者ID:AndrewBell,项目名称:RCbot,代码行数:18,代码来源:QueryBO.java

示例3: onMessage

import org.pircbotx.hooks.events.MessageEvent; //导入方法依赖的package包/类
@Override
public void onMessage(MessageEvent<PircBotX> event) throws Exception {
	//Handles only channelwide mesages.
	String channel = event.getChannel().getName();
	String message = event.getMessage();
	String user = event.getUser().getNick();
	long timestamp = event.getTimestamp();

	manager.messageReceived(channel, message, user);
}
 
开发者ID:bmoyer,项目名称:osrsclient,代码行数:11,代码来源:NetworkSession.java

示例4: getNow

import org.pircbotx.hooks.events.MessageEvent; //导入方法依赖的package包/类
public Timestamp getNow(MessageEvent<MyPircBotX> event) {
	return new Timestamp(event.getTimestamp());
}
 
开发者ID:AndrewBell,项目名称:RCbot,代码行数:4,代码来源:QueryBO.java

示例5: getDaysAgo

import org.pircbotx.hooks.events.MessageEvent; //导入方法依赖的package包/类
public Timestamp getDaysAgo(MessageEvent<MyPircBotX> event, int i) {
	return new Timestamp(event.getTimestamp()-(DAY*i));
}
 
开发者ID:AndrewBell,项目名称:RCbot,代码行数:4,代码来源:QueryBO.java

示例6: getHoursFromNow

import org.pircbotx.hooks.events.MessageEvent; //导入方法依赖的package包/类
public Timestamp getHoursFromNow(MessageEvent<MyPircBotX> event, int hours) {
	return new Timestamp(event.getTimestamp()+(hours*HOUR));
}
 
开发者ID:AndrewBell,项目名称:RCbot,代码行数:4,代码来源:QueryBO.java


注:本文中的org.pircbotx.hooks.events.MessageEvent.getTimestamp方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。