本文整理汇总了Java中com.ullink.slack.simpleslackapi.SlackSession.findUserById方法的典型用法代码示例。如果您正苦于以下问题:Java SlackSession.findUserById方法的具体用法?Java SlackSession.findUserById怎么用?Java SlackSession.findUserById使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.ullink.slack.simpleslackapi.SlackSession
的用法示例。
在下文中一共展示了SlackSession.findUserById方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: extractChannelCreatedEvent
import com.ullink.slack.simpleslackapi.SlackSession; //导入方法依赖的package包/类
private static SlackChannelCreated extractChannelCreatedEvent(SlackSession slackSession, JSONObject obj)
{
JSONObject channelJSONObject = (JSONObject) obj.get("channel");
SlackChannel channel = parseChannelDescription(channelJSONObject);
String creatorId = (String) channelJSONObject.get("creator");
SlackUser user = slackSession.findUserById(creatorId);
return new SlackChannelCreatedImpl(channel, user);
}
示例2: parseBotMessage
import com.ullink.slack.simpleslackapi.SlackSession; //导入方法依赖的package包/类
private static SlackMessagePostedImpl parseBotMessage(JSONObject obj, SlackChannel channel, String ts, SlackSession slackSession)
{
String text = (String) obj.get("text");
String botId = (String) obj.get("bot_id");
SlackUser user = slackSession.findUserById(botId);
return new SlackMessagePostedImpl(text, user, user, channel, ts);
}
示例3: parseMessagePublished
import com.ullink.slack.simpleslackapi.SlackSession; //导入方法依赖的package包/类
private static SlackMessagePostedImpl parseMessagePublished(JSONObject obj, SlackChannel channel, String ts, SlackSession slackSession) {
String text = (String) obj.get("text");
String userId = (String) obj.get("user");
SlackUser user = slackSession.findUserById(userId);
Map<String, Integer> reacs = extractReactionsFromMessageJSON(obj);
SlackMessagePostedImpl message = new SlackMessagePostedImpl(text, user, user, channel, ts);
message.setReactions(reacs);
return message;
}
示例4: extractChannelUnarchiveEvent
import com.ullink.slack.simpleslackapi.SlackSession; //导入方法依赖的package包/类
private static SlackChannelUnarchived extractChannelUnarchiveEvent(SlackSession slackSession, JSONObject obj)
{
String channelId = (String) obj.get("channel");
String userId = (String) obj.get("user");
return new SlackChannelUnarchivedImpl(slackSession.findChannelById(channelId), slackSession.findUserById(userId));
}
示例5: extractChannelArchiveEvent
import com.ullink.slack.simpleslackapi.SlackSession; //导入方法依赖的package包/类
private static SlackChannelArchived extractChannelArchiveEvent(SlackSession slackSession, JSONObject obj)
{
String channelId = (String) obj.get("channel");
String userId = (String) obj.get("user");
return new SlackChannelArchivedImpl(slackSession.findChannelById(channelId), slackSession.findUserById(userId));
}
示例6: parseMessagePublishedWithFile
import com.ullink.slack.simpleslackapi.SlackSession; //导入方法依赖的package包/类
private static SlackMessagePostedImpl parseMessagePublishedWithFile(JSONObject obj, SlackChannel channel, String ts, SlackSession slackSession)
{
/*
Example of message with file
{"type":"message","subtype":"file_share","text":"<@U024SEY12|ben> uploaded a file: <https://test-team.slack.com/files/ben/F0D34F799/1388485488946.png|1388485488946.png>","file":{"id":"F0D34F799","created":1445615453,"timestamp":1445615453,"name":"1388485488946.png","title":"1388485488946.png","mimetype":"image/png","filetype":"png","pretty_type":"PNG","user":"U024SEY12","editable":false,"size":467034,"mode":"hosted","is_external":false,"external_type":"","is_public":false,"public_url_shared":false,"display_as_bot":false,"username":"","url":"https://slack-files.com/files-pub/T01234567-F0D34F799-dfacea79ee/1388485488946.png","url_download":"https://slack-files.com/files-pub/T01234567-F0D34F799-dfacea79ee/download/1388485488946.png","url_private":"https://files.slack.com/files-pri/T01234567-F0D34F799/1388485488946.png","url_private_download":"https://files.slack.com/files-pri/T01234567-F0D34F799/download/1388485488946.png","thumb_64":"https://slack-files.com/files-tmb/T01234567-F0D34F799-c329abf88c/1388485488946_64.png","thumb_80":"https://slack-files.com/files-tmb/T01234567-F0D34F799-c329abf88c/1388485488946_80.png","thumb_360":"https://slack-files.com/files-tmb/T01234567-F0D34F799-c329abf88c/1388485488946_360.png","thumb_360_w":360,"thumb_360_h":244,"thumb_480":"https://slack-files.com/files-tmb/T01234567-F0D34F799-c329abf88c/1388485488946_480.png","thumb_480_w":480,"thumb_480_h":325,"thumb_160":"https://slack-files.com/files-tmb/T01234567-F0D34F799-c329abf88c/1388485488946_160.png","thumb_720":"https://slack-files.com/files-tmb/T01234567-F0D34F799-c329abf88c/1388485488946_720.png","thumb_720_w":720,"thumb_720_h":488,"image_exif_rotation":1,"original_w":797,"original_h":540,"permalink":"https://bentest1.slack.com/files/ben/F0D34F799/1388485488946.png","permalink_public":"https://slack-files.com/T01234567-F0D34F799-dfacea79ee","channels":[],"groups":[],"ims":[],"comments_count":0},"user":"U024SEY12","upload":true,"display_as_bot":false,"username":"<@U024SEY12|ben>","bot_id":null,"channel":"D0251JL9Y","ts":"1445615455.000002"}
*/
SlackFile file = new SlackFile();
if(obj.get("file")!=null){
JSONObject rawFile = (JSONObject) obj.get("file");
file.setId((String) rawFile.get("id"));
file.setName((String) rawFile.get("name"));
file.setTitle((String) rawFile.get("title"));
file.setMimetype((String) rawFile.get("mimetype"));
file.setFiletype((String) rawFile.get("filetype"));
file.setUrl((String) rawFile.get("url"));
file.setUrlDownload((String) rawFile.get("url_download"));
file.setUrlPrivate((String) rawFile.get("url_private"));
file.setUrlPrivateDownload((String) rawFile.get("url_private_download"));
file.setThumb64((String) rawFile.get("thumb_64"));
file.setThumb80((String) rawFile.get("thumb_80"));
file.setThumb160((String) rawFile.get("thumb_160"));
file.setThumb360((String) rawFile.get("thumb_360"));
file.setThumb480((String) rawFile.get("thumb_480"));
file.setThumb720((String) rawFile.get("thumb_720"));
try{
file.setOriginalH((Long) rawFile.get("original_h"));
file.setOriginalW((Long) rawFile.get("original_w"));
file.setImageExifRotation((Long) rawFile.get("image_exif_rotation"));
}catch(Exception e){
//this properties will be null if something goes wrong
}
file.setPermalink((String) rawFile.get("permalink"));
file.setPermalinkPublic((String) rawFile.get("permalink_public"));
}
String text = (String) obj.get("text");
String comment = null;
int idx = text.indexOf(COMMENT_PLACEHOLDER);
if (idx != -1) {
comment = text.substring(idx + COMMENT_PLACEHOLDER.length());
}
file.setComment(comment);
String userId = (String) obj.get("user");
SlackUser user = slackSession.findUserById(userId);
return new SlackMessagePostedImpl(text, user, user, channel, ts,file,obj);
}