Class GuildVoiceRequestToSpeakEvent
- All Implemented Interfaces:
GenericEvent
Request-to-Speak
.
If getNewTime()
is non-null, this means the member has raised their hand and wants to speak.
You can use approveSpeaker()
or declineSpeaker()
to handle this request if you have Permission.VOICE_MUTE_OTHERS
.
Requirements
These events require the VOICE_STATE
CacheFlag to be enabled, which requires
the GUILD_VOICE_STATES
intent.
createLight(String)
disables that CacheFlag by default!
Additionally, these events require the MemberCachePolicy
to cache the updated members. Discord does not specifically tell us about the updates, but merely tells us the
member was updated and gives us the updated member object. In order to fire specific events like these we
need to have the old member cached to compare against.
-
Constructor Summary
ConstructorDescriptionGuildVoiceRequestToSpeakEvent
(JDA api, long responseNumber, Member member, OffsetDateTime oldTime, OffsetDateTime newTime) -
Method Summary
Modifier and TypeMethodDescriptionPromote the member to speaker.Reject this membersrequest to speak
.Methods inherited from class net.dv8tion.jda.api.events.guild.voice.GenericGuildVoiceEvent
getMember, getVoiceState
Methods inherited from class net.dv8tion.jda.api.events.guild.GenericGuildEvent
getGuild
Methods inherited from class net.dv8tion.jda.api.events.Event
getJDA, getRawData, getResponseNumber, toString
-
Constructor Details
-
GuildVoiceRequestToSpeakEvent
public GuildVoiceRequestToSpeakEvent(@Nonnull JDA api, long responseNumber, @Nonnull Member member, @Nullable OffsetDateTime oldTime, @Nullable OffsetDateTime newTime)
-
-
Method Details
-
getOldTime
- Returns:
- The old timestamp, or null if this member did not request to speak before
-
getNewTime
- Returns:
- The new timestamp, or null if the request to speak was declined or cancelled
-
approveSpeaker
Promote the member to speaker.This requires a non-null
getNewTime()
. You can useGuildVoiceState.inviteSpeaker()
to invite the member to become a speaker if they haven't requested to speak.This does nothing if the member is not connected to a
StageChannel
.- Returns:
RestAction
- Throws:
InsufficientPermissionException
- If the currently logged in account does not havePermission.VOICE_MUTE_OTHERS
in the associatedStageChannel
-
declineSpeaker
Reject this membersrequest to speak
.This requires a non-null
getNewTime()
. The member will have to request to speak again.This does nothing if the member is not connected to a
StageChannel
.- Returns:
RestAction
- Throws:
InsufficientPermissionException
- If the currently logged in account does not havePermission.VOICE_MUTE_OTHERS
in the associatedStageChannel
-