Package io.github.jtwitch.action
Record Class ScheduleAction
java.lang.Object
java.lang.Record
io.github.jtwitch.action.ScheduleAction
Represent what to on a specific time.
It is used when you build a
You can for instance send `Hello world` all 5 minutes with :
It is used when you build a
TwitchBot
with method TwitchBot.withScheduleAction(int, Action)
.
You can for instance send `Hello world` all 5 minutes with :
new TwitchBot(user, token).withScheduleAction(300, bot -> bot.send("streamerName", "Hello World")
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interface
the action to be scheduled. -
Constructor Summary
ConstructorsConstructorDescriptionScheduleAction(int periodInSecond, ScheduleAction.Action action)
Creates an instance of aScheduleAction
record class. -
Method Summary
Modifier and TypeMethodDescriptionaction()
Returns the value of theaction
record component.boolean
Indicates whether some other object is "equal to" this one.int
hashCode()
Returns a hash code value for this object.int
Returns the value of theperiodInSecond
record component.void
run(ConnectedTwitchBot bot)
run a schedule action.toString()
Returns a string representation of this record class.
-
Constructor Details
-
ScheduleAction
Creates an instance of aScheduleAction
record class.- Parameters:
periodInSecond
- the value for theperiodInSecond
record componentaction
- the value for theaction
record component
-
-
Method Details
-
run
run a schedule action.- Parameters:
bot
- the bot when it is connected to the twitch socket
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object)
; primitive components are compared with '=='. -
periodInSecond
public int periodInSecond()Returns the value of theperiodInSecond
record component.- Returns:
- the value of the
periodInSecond
record component
-
action
Returns the value of theaction
record component.- Returns:
- the value of the
action
record component
-