本文整理匯總了Java中net.dv8tion.jda.core.events.user.UserTypingEvent類的典型用法代碼示例。如果您正苦於以下問題:Java UserTypingEvent類的具體用法?Java UserTypingEvent怎麽用?Java UserTypingEvent使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
UserTypingEvent類屬於net.dv8tion.jda.core.events.user包,在下文中一共展示了UserTypingEvent類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onUserTyping
import net.dv8tion.jda.core.events.user.UserTypingEvent; //導入依賴的package包/類
@Override
public void onUserTyping(UserTypingEvent event)
{
Logger LOG = LoggerFactory.getLogger("AFK Manager");
User user = event.getUser();
if(AfkManager.isAfk(user.getIdLong()))
{
user.openPrivateChannel().queue(pc -> pc.sendMessage(config.getDoneEmote()+" I've removed your AFK status.").queue(null,
(e) -> LOG.warn("I was not able to DM "+user.getName()+"#"+user.getDiscriminator()+" about removing its AFK status.")));
AfkManager.unsetAfk(user.getIdLong());
}
}
示例2: onUserTyping
import net.dv8tion.jda.core.events.user.UserTypingEvent; //導入依賴的package包/類
@Override
public void onUserTyping(UserTypingEvent event) {
//TODO add user typing actions
}
示例3: handleInternally
import net.dv8tion.jda.core.events.user.UserTypingEvent; //導入依賴的package包/類
@Override
protected Long handleInternally(JSONObject content)
{
final long channelId = content.getLong("channel_id");
MessageChannel channel = api.getTextChannelMap().get(channelId);
if (channel == null)
channel = api.getPrivateChannelMap().get(channelId);
if (channel == null)
channel = api.getFakePrivateChannelMap().get(channelId);
if (channel == null && api.getAccountType() == AccountType.CLIENT)
channel = api.asClient().getGroupById(channelId);
if (channel == null)
return null; //We don't have the channel cached yet. We chose not to cache this event
// because that happen very often and could easily fill up the EventCache if
// we, for some reason, never get the channel. Especially in an active channel.
if (channel instanceof TextChannel)
{
final long guildId = ((TextChannel) channel).getGuild().getIdLong();
if (api.getGuildLock().isLocked(guildId))
return guildId;
}
final long userId = content.getLong("user_id");
User user;
if (channel instanceof PrivateChannel)
user = ((PrivateChannel) channel).getUser();
else if (channel instanceof Group)
user = ((GroupImpl) channel).getUserMap().get(userId);
else
user = api.getUserMap().get(userId);
if (user == null)
return null; //Just like in the comment above, if for some reason we don't have the user for some reason
// then we will just throw the event away.
OffsetDateTime timestamp = Instant.ofEpochSecond(content.getInt("timestamp")).atOffset(ZoneOffset.UTC);
api.getEventManager().handle(
new UserTypingEvent(
api, responseNumber,
user, channel, timestamp));
return null;
}