Utils
Utilities
Various utility functions S.D.G.
get_safe_filename(clip_save_path, filename, extension=static.Clip.save_extension)
Make a filename that will not overwrite other files
Parameters:
Name | Type | Description | Default |
---|---|---|---|
clip_save_path
|
str
|
The path to the folder to save the clip in. |
required |
filename
|
str
|
The desired base filename. |
required |
extension
|
str
|
The file name extension for the type of file to save. Defaults to static.Clip.save_extension |
save_extension
|
Returns:
Name | Type | Description |
---|---|---|
safe_filename |
str
|
The base filename with a numeric suffix added as needed. |
Source code in rumchat_actor/utils.py
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
|
is_staff(user)
Check if a user is channel staff
Parameters:
Name | Type | Description | Default |
---|---|---|---|
user
|
User
|
A user in the chat (importantly with a badges attribute) |
required |
Returns:
Name | Type | Description |
---|---|---|
Result |
bool
|
Does the user have staff badges (admin or moderator)? |
Source code in rumchat_actor/utils.py
11 12 13 14 15 16 17 18 19 20 |
|
Note that cocorum.utils is imported globally into this module.