本文整理汇总了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;
}
示例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;
}
}
示例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);
}
示例4: getNow
import org.pircbotx.hooks.events.MessageEvent; //导入方法依赖的package包/类
public Timestamp getNow(MessageEvent<MyPircBotX> event) {
return new Timestamp(event.getTimestamp());
}
示例5: getDaysAgo
import org.pircbotx.hooks.events.MessageEvent; //导入方法依赖的package包/类
public Timestamp getDaysAgo(MessageEvent<MyPircBotX> event, int i) {
return new Timestamp(event.getTimestamp()-(DAY*i));
}
示例6: getHoursFromNow
import org.pircbotx.hooks.events.MessageEvent; //导入方法依赖的package包/类
public Timestamp getHoursFromNow(MessageEvent<MyPircBotX> event, int hours) {
return new Timestamp(event.getTimestamp()+(hours*HOUR));
}