from vk_api.longpoll import Event, VkEventType from configs import store from utils import Base store if store.config.get("TriggerDelete") else store.add_value("TriggerDelete", "ой") store if store.config.get("TriggerTranslate") else store.add_value("TriggerTranslate", "рас") store.save() class Main(Base): __flags__ = { VkEventType.MESSAGE_NEW: True, VkEventType.MESSAGE_FLAGS_SET: False, VkEventType.MESSAGE_EDIT: False } def __init__(self, event: Event): self.disable = False self.event = event def message_new(self): if self.event.user_id == store.bot.user_id and self.event.from_chat: message = self.event.text.lower() if message.startswith(store.config.TriggerDelete): message_ = message.replace(store.config.TriggerDelete, '') if not len(message_): message_ = str(abs(len(message_) + 1)) if message_.isdigit(): res = store.bot.api.messages.getHistory(peer_id=self.event.peer_id)
import os from urllib.request import urlretrieve from vk_api.longpoll import Event, VkEventType from vk_api.upload import VkUpload from configs import store from utils import Base store if store.config.get("TriggerAddAudio") else store.add_value( "TriggerAddAudio", "!гс") store if store.config.get("TriggerAudio") else store.add_value( "TriggerAudio", ".") store if store.config.get("audio_cache") else store.add_value( "audio_cache", {}) store.save() def GetLinkAudio(response): if response: attachments = response.get("attachments") for attach in attachments: audio_message = attach.get("audio_message") if audio_message: return audio_message.get("link_ogg") return "" audios = []
import datetime import random import re import time from vk_api.longpoll import Event, VkEventType from configs import store from utils import Base store if store.config.get("TriggerAddStickers") else store.add_value("TriggerAddStickers", "!+") store if store.config.get("TriggerIgnoreMention") else store.add_value("TriggerIgnoreMention", "!игнор") store if store.config.get("TimeWait") else store.add_value("TimeWait", 5) store if store.config.get("TimeOutDel") else store.add_value("TimeOutDel", 10) store if store.config.get("Answers") else store.add_value("Answers", []) store if store.config.get("IgnoreListMention") else store.add_value("IgnoreListMention", []) store if store.config.get("TriggerStickers") else store.add_value("TriggerStickers", []) store.save() def CheckMarkUser(for_finder): _for_finder = for_finder.split() for x in store.config.TriggerStickers: if x.lower() in _for_finder: return True # if store.config.TriggerStickers: # finder = re.search(rf"(\s+|^)({re.escape('|'.join(store.config.TriggerStickers))})(\s+|$)", for_finder) # if finder is not None: # return True finder = re.search(rf"\[id{store.bot.user_id}\|(?:|@).{{2,15}}\]", for_finder) if finder is not None:
import datetime from vk_api.longpoll import Event, VkEventType from configs import store from utils import Base store if store.config.get("TriggerShowLog") else store.add_value("TriggerShowLog", "!лог") store if store.config.get("TriggerToAddChatLogs") else store.add_value("TriggerToAddChatLogs", "!добавить чат") store if store.config.get("TriggerShowChatsLogs") else store.add_value("TriggerShowChatsLogs", "!все чаты") store if store.config.get("WhiteListChat") else store.add_value("WhiteListChat", []) store.save() class Message: def __init__(self, _user_id, _peer_id, _message_id): self.user_id = _user_id self.peer_id = _peer_id self.access = self.peer_id in store.config.WhiteListChat self.name = Base.GetNameUsers(self.user_id) + ":" self._text = "" self.attachments = [] self.message_id = _message_id self.date = datetime.datetime.now().strftime("[%H:%M:%S]") self.deleted = False self.edited = False self.count_edited = 0 self.audio = False @property def text(self):