Actions
Common message actions
Actions commonly run on chat messages
This file is part of Rumble Chat Actor.
Rumble Chat Actor is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
Rumble Chat Actor is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with Rumble Chat Actor. If not, see https://www.gnu.org/licenses/.
S.D.G
ChatBlipper
Blip with chat activity, getting fainter as activity gets more common
Source code in rumchat_actor/actions.py
214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 | |
current_volume
property
Calculate the current volume based on how rare messages have been, from 0 to 1
__init__(sound_filename, rarity_regen_time=60, stay_dead_time=10, rarity_reduce=0.1)
Blip with chat activity, getting fainter as activity gets more common. Instance this object, then pass it to RumbleChatActor().register_message_action()
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sound_filename
|
str
|
The filename of the blip sound to play. |
required |
rarity_regen_time
|
int
|
How long before the blip volume regenerates to maximum, in seconds. |
60
|
stay_dead_time
|
int
|
Effectively more regen time, in seconds, but with the volume staying at zero for the duration. |
10
|
rarity_reduce
|
float
|
How much a message reduces the volume in factor, ranging from >0 to 1. |
0.1
|
Source code in rumchat_actor/actions.py
217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 | |
action(message, act_props, actor)
Blip for a chat message, taking rarity into account for the volume
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
message
|
Message
|
The chat message to run this action on. |
required |
act_props
|
dict
|
Action properties, aka metadata about what other things did with this message |
required |
actor
|
RumbleChatActor
|
The chat actor. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
act_props |
dict
|
Dictionary of additional recorded properties from running this action. |
Source code in rumchat_actor/actions.py
261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 | |
load_sound(fn)
Load a sound from a file to use as a blip
Source code in rumchat_actor/actions.py
236 237 238 239 240 241 242 | |
reduce_rarity()
Reduce the remembered rarity of a message
Source code in rumchat_actor/actions.py
249 250 251 252 253 254 255 256 257 258 259 | |
RantTTSManager
System to TTS rant messages, with threshhold settings
Source code in rumchat_actor/actions.py
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 | |
tts_amount_threshold
property
writable
The amount a rant must be to be TTS-ed, 0 means all rants are TTS-ed
__init__()
System to TTS rant messages, with threshhold settings. Instance this object, then pass it to RumbleChatActor().register_message_action()
Source code in rumchat_actor/actions.py
89 90 91 92 93 94 95 96 97 | |
action(message, act_props, actor)
TTS rants above the manager instance's threshhold
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
message
|
Message
|
The chat message to run this action on. |
required |
act_props
|
dict
|
Action properties, aka metadata about what other things did with this message |
required |
actor
|
RumbleChatActor
|
The chat actor. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
act_props |
dict
|
Dictionary of additional recorded properties from running this action. |
Source code in rumchat_actor/actions.py
124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 | |
set_rant_tts_sayer(new)
Set the callable to be used on rant TTS
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
new
|
callable
|
The function or method to call, passing the message text. |
required |
Source code in rumchat_actor/actions.py
115 116 117 118 119 120 121 122 | |
Thanker
Bases: Thread
Thank followers and subscribers in the chat
Source code in rumchat_actor/actions.py
278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 | |
__init__(actor, **kwargs)
Thank followers and subscribers in the chat. Instance this object, then pass it to RumbleChatActor().register_message_action()
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
actor
|
RumbleChatActor
|
The Rumble Chat Actor instance. |
required |
follower_message
|
str
|
Message to format with Cocorum Follower object. Defaults to static.Thank.DefaultMessages.follower |
required |
subscriber_message
|
str
|
Message to format with the Cocorum Subscriber object. Defaults to static.Thank.DefaultMessages.subscriber |
required |
gifted_subs_message
|
str
|
Message to format with the Cocorum GiftPurchaseNotification object. Defaults to static.Thank.DefaultMessages.gifted_subs |
required |
Source code in rumchat_actor/actions.py
281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 | |
action(message, act_props, actor)
Check for subscription gifts, and thank for them
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
message
|
Message
|
The chat message to run this action on. |
required |
act_props
|
dict
|
Action properties, aka metadata about what other things did with this message |
required |
actor
|
RumbleChatActor
|
The chat actor. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
act_props |
dict
|
Dictionary of additional recorded properties from running this action. |
Source code in rumchat_actor/actions.py
310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 | |
run()
Continuously check for new followers and subscribers
Source code in rumchat_actor/actions.py
331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 | |
TimedMessagesManager
System to send messages on a timed basis
Source code in rumchat_actor/actions.py
145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 | |
__init__(actor, messages, delay=60, in_between=0)
System to send messages on a timed basis. Instance this object, then pass it to RumbleChatActor().register_message_action()
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
actor
|
RumbleChatActor
|
The actor, to send the timed messages, |
required |
messages
|
list
|
List of str messages to send |
required |
delay
|
int
|
Time between messages in seconds |
60
|
in_between
|
int
|
Number of messages that must be sent before we send another timed one |
0
|
Source code in rumchat_actor/actions.py
148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 | |
action(message, act_props, actor)
Count the messages sent
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
message
|
Message
|
The chat message to run this action on. |
required |
act_props
|
dict
|
Action properties, aka metadata about what other things did with this message |
required |
actor
|
RumbleChatActor
|
The chat actor. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
act_props |
dict
|
Dictionary of additional recorded properties from running this action. |
Source code in rumchat_actor/actions.py
179 180 181 182 183 184 185 186 187 188 189 190 191 | |
sender_loop()
Continuously wait till it is time to send another message
Source code in rumchat_actor/actions.py
193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 | |
UserAnnouncer
Announce new users as they arrive in the chat
Source code in rumchat_actor/actions.py
349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 | |
__init__(announcer=None, known_users=[], special_announcers={})
Announce new users as they arrive in the chat
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
announcer
|
callable
|
Function or method to call. Will be passed the message action special of message, act_props, and actor. Should return act_props dict likewise. Defaults to None. |
None
|
known_users
|
list
|
List of users not to announce. Useful if you
only want this announcer to go off for brand new chatters. You
can save this list after actor exit from this object's
|
[]
|
special_announcers
|
dict[str, callable]
|
Dict of username to announcer callable pairs. Should take same args as regular announcers, but they will only be called on the username that matches them. |
{}
|
Source code in rumchat_actor/actions.py
352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 | |
action(message, act_props, actor)
Announce the user if they are new
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
message
|
Message
|
The chat message to run this action on. |
required |
act_props
|
dict
|
Action properties, aka metadata about what other things did with this message |
required |
actor
|
RumbleChatActor
|
The chat actor. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
act_props |
dict
|
Dictionary of additional recorded properties from running this action. |
Source code in rumchat_actor/actions.py
373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 | |
ollama_message_moderate(message, act_props, actor)
Moderate a message with Ollama, deleting if needed
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
message
|
Message
|
The chat message to run this action on. |
required |
act_props
|
dict
|
Action properties, aka metadata about what other things did with this message |
required |
actor
|
RumbleChatActor
|
The chat actor. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
act_props |
dict
|
Dictionary of recorded properties from running this action. |
Source code in rumchat_actor/actions.py
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 | |
This file is part of Rumble Chat Actor.
Rumble Chat Actor is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
Rumble Chat Actor is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with Rumble Chat Actor. If not, see https://www.gnu.org/licenses/.
S.D.G.