def create_hen_name_list(): global avail_hen_name_list namelist_f = tetueSrc.get_string_list("hunname", "list_name_f") # Read all possible Hen-Names namelist_m = tetueSrc.get_string_list("hunname", "list_name_m") # Read all possible Hen-Names prop_list = tetueSrc.get_string_list("hunname", "propertie") # Read all possible properties exist_hen_names = [x[0] for x in db.session.query(db.User.hen_name).filter(db.User.hen_name != None).all()] # Create list with all possible combinations of names hen_name_list_f = [("".join([prop, " ", name])) for name in namelist_f for prop in prop_list if (name.lower().startswith(prop[:1]) and ("".join([prop, " ", name]) not in exist_hen_names))] hen_name_list_m = [("".join([prop, "r ", name])) for name in namelist_m for prop in prop_list if (name.lower().startswith(prop[:1]) and ("".join([prop, " ", name]) not in exist_hen_names))] avail_hen_name_list = hen_name_list_f + hen_name_list_m
def trigger_lurk_bots(bot): trigger_time_for_lurk_bots = tetueSrc.get_string_list("automod", "time_last_bot_started") time_thr = tetueSrc.get_string_list("automod", "time_thr_lurk_bot_start_in_days") if (datetime.now() - datetime.strptime(trigger_time_for_lurk_bots, "%d/%m/%y %H:%M:%S")).days < time_thr: return tetueSrc.save_timestamp_element("automod", "time_last_bot_started", datetime.now()) trigger_categories_for_lurk_bots = tetueSrc.get_string_list("automod", "trigger_categories") channel_info = bot.get_channel_info() correct_category = any([True for category in trigger_categories_for_lurk_bots if category == channel_info["Game"]]) if correct_category is False: return trigger_words_for_lurk_bots = tetueSrc.get_string_list("automod", "trigger_lurk_bots") if len(trigger_words_for_lurk_bots) == 0: return output_text = "Probleme über Probleme und ein planloser TeTü. Ich wünschte " if len(trigger_words_for_lurk_bots) < 2: output_text += "@" + trigger_words_for_lurk_bots[0] + " wäre hier!" else: for i in range(len(trigger_words_for_lurk_bots) - 1): output_text += "@" + trigger_words_for_lurk_bots[i] if i != len(trigger_words_for_lurk_bots) - 2: output_text += ", " output_text += " oder @" + trigger_words_for_lurk_bots[len(trigger_words_for_lurk_bots) - 1] + " wären hier!" bot.send_message(output_text)
def main(): testbla("Zeile 1", "Zeile 2") testbla("Zeile 1", "Zeile 2", para3="Zeile 3") FILLER_WORDS = tetueSrc.get_string_list("automod", "list_filler_sign") BAD_WORDS_LIST = tetueSrc.get_string_list("automod", "list_badwords") text = "halLO du d.e.p p" temp_text = text.lower() for element in FILLER_WORDS: temp_text = temp_text.replace(element, "") # for zeichen in BAD_WORDS_LIST: # if zeichen in temp_text: # print("gefunden: " + zeichen) # break # if any(element in temp_text for element in BAD_WORDS_LIST): # print(element) if any(word in temp_text for word in BAD_WORDS_LIST): print("Böses Wort gefunden") temp_text2 = "hallo du depp" said_badwords = [word for word in temp_text2.lower().split() if word in BAD_WORDS_LIST] print(said_badwords) temp_message = "buy followers, primes or viewers on ..." r = re.compile(pattern_1, flags=re.I | re.X) if len(r.findall(temp_message)) >= bad_advertising_word_thr: print("Gotcha") else: print("no") for element in filler_sign_list: temp_message = temp_message.replace(element, "") print(temp_message) if len(r.findall(temp_message)) >= bad_advertising_word_thr: print("Gotcha") else: print("no")
import db import tetueSrc import re from datetime import datetime warning_timers = (1, 5, 60) filler_sign_list = tetueSrc.get_string_list("automod", "list_filler_sign") bad_word_list = tetueSrc.get_string_list("automod", "list_badwords") failed_cmd_thr = tetueSrc.get_int_element("automod", "num_failed_cmd_thr") bad_advertising_word_thr = tetueSrc.get_string_list("automod", "bad_advertising_word_thr") pattern_1 = r"\bbuy\b | \bfollowers\b | \bprimes\b | \bviewers\b | \bon\b" temp_failed_cmd_thr_active = True def trigger_lurk_bots(bot): trigger_time_for_lurk_bots = tetueSrc.get_string_list("automod", "time_last_bot_started") time_thr = tetueSrc.get_string_list("automod", "time_thr_lurk_bot_start_in_days") if (datetime.now() - datetime.strptime(trigger_time_for_lurk_bots, "%d/%m/%y %H:%M:%S")).days < time_thr: return tetueSrc.save_timestamp_element("automod", "time_last_bot_started", datetime.now()) trigger_categories_for_lurk_bots = tetueSrc.get_string_list("automod", "trigger_categories") channel_info = bot.get_channel_info() correct_category = any([True for category in trigger_categories_for_lurk_bots if category == channel_info["Game"]]) if correct_category is False: return trigger_words_for_lurk_bots = tetueSrc.get_string_list("automod", "trigger_lurk_bots") if len(trigger_words_for_lurk_bots) == 0: return output_text = "Probleme über Probleme und ein planloser TeTü. Ich wünschte " if len(trigger_words_for_lurk_bots) < 2: output_text += "@" + trigger_words_for_lurk_bots[0] + " wäre hier!" else: for i in range(len(trigger_words_for_lurk_bots) - 1): output_text += "@" + trigger_words_for_lurk_bots[i]
from time import time import automod import economy import games import misc import mod import tetueSrc import user_management PREFIXMSG = tetueSrc.get_string_element("general", "prefix_msg") PREFIXTWE = tetueSrc.get_string_element("general", "prefix_twe") CMD_TEA_BUTTLER = tetueSrc.get_string_list("tea_butler", "cmd_tea") \ + tetueSrc.get_string_list("tea_butler", "cmd_coffee") CMD_HONOR = tetueSrc.get_string_list("feat_honor", "cmd_honor") class Cmd(object): def __init__(self, callables, func, function_info, rights=user_management.Badge.Tueftlie, cooldown=0): self.callables = callables self.func = func self.cooldown = cooldown self.next_use = time() self.allowed = True self.function_info = function_info self.rights = rights
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import tetueSrc import tweepy # tetueSrc.log_event_warning("") read_successful, cfg_owner = tetueSrc.get_configuration("twitter") client = tweepy.Client(bearer_token=cfg_owner["bearer_token"], consumer_key=cfg_owner["consumer_key"], consumer_secret=cfg_owner["consumer_secret"], access_token=cfg_owner["access_token"], access_token_secret=cfg_owner["access_token_secret"]) registered_hashtags = set( tetueSrc.get_string_list("twitter_bot", "start_hashtags")) max_hashtags = tetueSrc.get_int_element("twitter_bot", "max_hashtags") hashtag_min_size = tetueSrc.get_int_element("twitter_bot", "hashtag_min_size") tweet_max_length = tetueSrc.get_int_element("twitter_bot", "tweet_max_length") def register_hashtag(bot, user, hashtag, *args): global registered_hashtags if len(registered_hashtags) >= max_hashtags: return registered_hashtags.add(hashtag) def main() -> None: pass if __name__ == "__main__":
import time from enum import Enum, auto from random import choice, shuffle import db import tetueSrc import user_management TEAANSWERTIME = tetueSrc.get_int_element("tea_butler", "answer_time") TEAANSWER = tetueSrc.get_string_list("tea_butler", "answer_butler") TEA_EMOTE = tetueSrc.get_string_element("tea_butler", "emote_tea") TEA_CMD = tetueSrc.get_string_list("tea_butler", "cmd_tea") COFFEE_EMOTE = tetueSrc.get_string_element("tea_butler", "emote_coffee") COFFEE_CMD = tetueSrc.get_string_list("tea_butler", "cmd_coffee") QUOTESPATH = tetueSrc.get_string_element("tea_butler", "quotes_path") HONORANSWERTIME = tetueSrc.get_int_element("feat_honor", "answer_time") HONOR_MIN_DIVISOR = tetueSrc.get_string_list("feat_honor", "divisor") DELETEANSWERTIME = tetueSrc.get_int_element("general", "answer_time") RUSROULETTE_GAME_TIME = tetueSrc.get_int_element("roulette", "answer_time") RUSROULETTE_GAME_TIMEOUT_TIME = tetueSrc.get_int_element( "roulette", "timeout_time") RUSROULETTE_GAME_BET_AMOUNT = tetueSrc.get_int_element("roulette", "bet_amount") num_pronunciation = { 1: "erste", 2: "zweite", 3: "dritte", 4: "vierte", 5: "fünfte", 6: "sechste"