|
ecasbot
1.3.1
EC AntiSpam bot for Telegram messenger
|
Public Member Functions | |
| None | __init__ (self, schid) |
| None | add_stopword (self, str stopword) |
| None | add_watch (self, int userid, int chatid) |
| list | admins (self) |
| int | bantime (self) |
| str | chkrgx (self) |
| int | fmterr (self) |
| int | fmtlog (self) |
| str | get_cfgpath (self) |
| list | get_watchers (self, int chatid) |
| None | load (self) |
| str | logtofile (self) |
| int | maxemoji (self) |
| int | maxname (self) |
| int | msggoal (self) |
| int | nickgoal (self) |
| None | remove_stopword (self, str stopword) |
| None | remove_watch (self, int userid, int chatid) |
| list | restent (self) |
| list | restricted_languages (self) |
| None | save (self) |
| list | stopwords (self) |
| str | stwrgx (self) |
| str | tgkey (self) |
| str | urlrgx (self) |
| list | watches (self) |
Static Public Member Functions | |
| int | get_logging_level () |
Private Member Functions | |
| bool | __check_schema (self, schid) |
| def | __check_watchers (self, int chatid) |
| None | __find_cfgfile (self) |
Private Attributes | |
| __appname | |
| __cfgfile | |
| __data | |
| None ecasbot.settings.Settings.__init__ | ( | self, | |
| schid | |||
| ) |
Main constructor of Settings class. :param schid: Required schema version.
|
private |
Check JSON config schema version. :param schid: New schema version. :return: True if equal.
|
private |
Check if specified chat ID listed in watch list. :param chatid: Chat ID. :return: Generator object.
|
private |
Get fully-qualified path to main configuration file.
| None ecasbot.settings.Settings.add_stopword | ( | self, | |
| str | stopword | ||
| ) |
Add a new stopword to the list of restricted words. :param stopword: Restricted word to add.
| None ecasbot.settings.Settings.add_watch | ( | self, | |
| int | userid, | ||
| int | chatid | ||
| ) |
Add new watch for reports feature. :param userid: User ID. :param chatid: Chat ID.
| list ecasbot.settings.Settings.admins | ( | self | ) |
Get bot admins list. This users can execute any bot command and even control supergroups using special bot actions. :return: Bot admins list.
| int ecasbot.settings.Settings.bantime | ( | self | ) |
Get user ban time (in seconds). Bot will restrict new users for this time. :return: Restriction time.
| str ecasbot.settings.Settings.chkrgx | ( | self | ) |
Get regular expression for checking user names on joining supergroups. :return: Regex for user names checking.
| int ecasbot.settings.Settings.fmterr | ( | self | ) |
Get custom formatter for stderr (journald) logs. :return: Custom formatter for stderr logs.
| int ecasbot.settings.Settings.fmtlog | ( | self | ) |
Get custom formatter for file logs. :return: Custom formatter for text logs.
| str ecasbot.settings.Settings.get_cfgpath | ( | self | ) |
Get directory where bot's configuration are stored. User can override this setting by exporting CFGPATH environment option. :return: Full directory path.
|
static |
Get current log level. User can override this setting by exporting LOGLEVEL environment option. :return:
| list ecasbot.settings.Settings.get_watchers | ( | self, | |
| int | chatid | ||
| ) |
Get watchers of specified chat. :param chatid: Chat ID. :return: List of watchers.
| None ecasbot.settings.Settings.load | ( | self | ) |
Load settings from JSON file.
| str ecasbot.settings.Settings.logtofile | ( | self | ) |
Get log file name. If not set or empty, stderr will be used. :return: Log file name.
| int ecasbot.settings.Settings.maxemoji | ( | self | ) |
Get maximum allowed emoji count in messages of new users. Bot will remove messages exceeding this limit. :return: Maximum emoji count in messages.
| int ecasbot.settings.Settings.maxname | ( | self | ) |
Get maximum allowed length of name. Bot will score users with very long names. :return: Maximum username length.
| int ecasbot.settings.Settings.msggoal | ( | self | ) |
Get number of score points after message checks required to delete it. :return: Maximum score points required.
| int ecasbot.settings.Settings.nickgoal | ( | self | ) |
Get number of score points after nickname checks required to block new joined user. :return: Maximum score points required.
| None ecasbot.settings.Settings.remove_stopword | ( | self, | |
| str | stopword | ||
| ) |
Remove stopword from the list of restricted words. :param stopword: Restricted word to remove.
| None ecasbot.settings.Settings.remove_watch | ( | self, | |
| int | userid, | ||
| int | chatid | ||
| ) |
Add watch for reports feature. :param userid: User ID. :param chatid: Chat ID.
| list ecasbot.settings.Settings.restent | ( | self | ) |
Get list of forbidden entitles for new users. Bot will remove any messages from restricted users contains any of it. :return: List of forbidden entitles.
| list ecasbot.settings.Settings.restricted_languages | ( | self | ) |
Get list of restricted languages. :return: Blocked langs list.
| None ecasbot.settings.Settings.save | ( | self | ) |
Save current settings to JSON file.
| list ecasbot.settings.Settings.stopwords | ( | self | ) |
Get list of forbidden words in nicknames of new users. Bot will score such users. :return: List of forbidden words in user names.
| str ecasbot.settings.Settings.stwrgx | ( | self | ) |
Get regular expression for checking forbidden words in nicknames or new messages. :return: Regex with forbidden words.
| str ecasbot.settings.Settings.tgkey | ( | self | ) |
Get Telegram Bot API token. :return: Bot API token.
| str ecasbot.settings.Settings.urlrgx | ( | self | ) |
Get regular expression for checking if string contains any URLs. :return: Regex for URL checking.
| list ecasbot.settings.Settings.watches | ( | self | ) |
Get watch list for reports feature. :return: Watch list.