# and is released under the "GNU v3.0 License Agreement". # Please see < https://github.com/UsergeTeam/Userge/blob/master/LICENSE > # # All rights reserved. # By @AsmSafone import os from userge import userge, Message, filters, config, get_collection from ...utils import ocr IS_ENABLED = False IS_ENABLED_FILTER = filters.create(lambda _, __, ___: IS_ENABLED) USER_DATA = get_collection("CONFIGS") CHANNEL = userge.getCLogger(__name__) @userge.on_start async def _init() -> None: global IS_ENABLED # pylint: disable=global-statement data = await USER_DATA.find_one({'_id': 'AUTO_FASTLY'}) if data: IS_ENABLED = data['on'] @userge.on_cmd("autofastly", about={ 'header': "Auto Fastly Response", 'description': "enable or disable auto fastly response", 'usage': "{tr}autofastly"},
CREDS: object = None AUTH_FLOW: object = None PARENT_ID = "" OAUTH_SCOPE = [ "https://www.googleapis.com/auth/drive", "https://www.googleapis.com/auth/drive.file", "https://www.googleapis.com/auth/drive.metadata" ] REDIRECT_URI = "urn:ietf:wg:oauth:2.0:oob" G_DRIVE_DIR_MIME_TYPE = "application/vnd.google-apps.folder" G_DRIVE_FILE_LINK = "📄 <a href='https://drive.google.com/open?id={}'>{}</a> __({})__" G_DRIVE_FOLDER_LINK = "📁 <a href='https://drive.google.com/drive/folders/{}'>{}</a> __(folder)__" LOG = userge.getLogger(__name__) GDRIVE_COLLECTION = get_collection("gdrive") class DBase: """ Database Class for GDrive. """ def __init__(self, id_: str) -> None: global CREDS self.__id = id_ LOG.debug("Setting GDrive DBase...") if not CREDS: result = GDRIVE_COLLECTION.find_one({'_id': self.__id}, {'creds': 1})
from pyrogram.errors import BotInlineDisabled from pyrogram.enums import ChatType from pyrogram.types import (InlineKeyboardMarkup, InlineKeyboardButton, InlineQueryResultArticle, InputTextMessageContent, CallbackQuery, InlineQuery) from userge import userge, config, filters, Message, get_collection from userge.utils import SafeDict from .. import pmpermit CHANNEL = userge.getCLogger(__name__) SAVED_SETTINGS = get_collection("CONFIGS") ALLOWED_COLLECTION = get_collection("PM_PERMIT") pmCounter: Dict[int, int] = {} allowAllFilter = filters.create(lambda _, __, ___: pmpermit.Dynamic.ALLOW_ALL_PMS) noPmMessage = bk_noPmMessage = ("Hello {fname} this is an automated message\n" "Please wait until you get approved to direct message " "And please dont spam until then ") blocked_message = bk_blocked_message = "**You were automatically blocked**" @userge.on_start async def _init() -> None: global noPmMessage, blocked_message # pylint: disable=global-statement async for chat in ALLOWED_COLLECTION.find({"status": 'allowed'}): pmpermit.ALLOWED_CHATS.add(chat.get("_id"))
# Thanks to @Intellivoid For Creating CoffeeHouse API import os import random import asyncio from time import time from coffeehouse.api import API from coffeehouse.lydia import LydiaAI, Session from coffeehouse.exception import CoffeeHouseError from pyrogram.errors.exceptions.bad_request_400 import PeerIdInvalid from userge import userge, get_collection, Message, Filters, Config, pool LYDIA_CHATS = get_collection("LYDIA_CHATS") CH_LYDIA_API = os.environ.get("CH_LYDIA_API", None) CUSTOM_REPLY_CHANNEL = int(os.environ.get("CUSTOM_REPLY_CHANNEL", 0)) if CH_LYDIA_API is not None: LYDIA = LydiaAI(API(CH_LYDIA_API)) ACTIVE_CHATS = {} CUSTOM_REPLIES = [] QUEUE = asyncio.Queue() LYDIA_API_INFO = """This module uses Lydia AI Powered by CoffeeHouse API created by @Intellivoid. Lydia is a Active Machine Learning Chat Bot. Which can adapt to current user and chat with user on any given topic."""
from abc import ABC, abstractmethod from typing import Optional, Tuple import aiohttp import spamwatch from UsergeAntiSpamApi import Client from pyrogram.errors.exceptions.bad_request_400 import (ChatAdminRequired, UserAdminInvalid, PeerIdInvalid) from pyrogram.types import User, Chat from userge import userge, Message, get_collection, filters, pool from .. import antispam from ..gban import is_whitelist SAVED_SETTINGS = get_collection("CONFIGS") GBAN_USER_BASE = get_collection("GBAN_USER") CHANNEL = userge.getCLogger(__name__) LOG = userge.getLogger(__name__) HANDLER = None _ID = {'_id': 'ANTISPAM_ENABLED'} @userge.on_start async def _init() -> None: s_o = await SAVED_SETTINGS.find_one(_ID) if s_o: antispam.Dynamic.ANTISPAM_SENTRY = s_o['data'] await _re_init_handler()
# Please see < https://github.com/uaudith/Userge/blob/master/LICENSE > # # All rights reserved import asyncio from typing import Union import aiohttp import spamwatch from spamwatch.types import Ban from pyrogram.errors.exceptions.bad_request_400 import (ChatAdminRequired, UserAdminInvalid) from userge import userge, Message, Config, get_collection, filters, pool SAVED_SETTINGS = get_collection("CONFIGS") GBAN_USER_BASE = get_collection("GBAN_USER") WHITELIST = get_collection("WHITELIST_USER") CHANNEL = userge.getCLogger(__name__) LOG = userge.getLogger(__name__) async def _init() -> None: s_o = await SAVED_SETTINGS.find_one({'_id': 'ANTISPAM_ENABLED'}) if s_o: Config.ANTISPAM_SENTRY = s_o['data'] @userge.on_cmd("antispam", about={ 'header': "enable / disable antispam",
import time from typing import Optional, List, Dict import wget from pyrogram.errors import UserIsBlocked, FloodWait from pyrogram.types import (Message as PyroMessage, InlineKeyboardMarkup, InlineKeyboardButton, CallbackQuery) from userge import userge, Message, config, filters, get_collection, pool from userge.utils import SafeDict, time_formatter from userge.utils.exceptions import StopConversation from .. import botpm CHANNEL = userge.getCLogger(__name__) USERS = get_collection("BOT_PM_USERS") HAVE_BLOCKED = get_collection("USER_BLOCKED_BOT_USERS") BANNED_USERS = get_collection("BANNED_USERS") U_ID_F_M_ID = get_collection("USER_ID_FROM_MESSAGE_ID") STATS = get_collection("BOT_PM_STATS") SAVED_SETTINGS = get_collection("CONFIGS") BOT_PM: bool = False IN_CONVO: bool = False _USERS: List[int] = [] _HAVE_BLOCKED: List[int] = [] _BANNED_USERS: List[int] = [] _U_ID_F_M_ID: Dict[int, int] = {} _STATS: Dict[str, int] = {"incoming": 0, "outgoing": 0} START_TEXT = " Hello {mention}, you can contact me using this Bot."
# Author: Copyright (C) 2020 KenHV [https://github.com/KenHV] # For USERGE-X # Ported to Pyrogram + Rewrite with Mongo DB # by: (TG - @DeletedUser420) [https://github.com/code-rgb] # Thanks @Lostb053 for writing help # Added proof forward and mass fban by @Kakashi_HTK/@ashwinstr import asyncio from pyrogram import filters from pyrogram.errors import FloodWait, PeerIdInvalid from userge import Config, Message, get_collection, userge FED_LIST = get_collection("FED_LIST") CHANNEL = userge.getCLogger(__name__) @userge.on_cmd( "addf", about={ "header": "Add a chat to fed list", "description": "Add a chat to fed list where message is to be sent", "usage": "{tr}addf", }, allow_bots=False, allow_channels=False, allow_private=False, ) async def addfed_(message: Message):
""" auto welcome and left messages """ import asyncio from pyrogram.errors import FloodWait from userge import Config, Message, filters, get_collection, userge WELCOME_COLLECTION = get_collection("welcome") LEFT_COLLECTION = get_collection("left") WELCOME_CHATS = filters.chat([]) LEFT_CHATS = filters.chat([]) CHANNEL = userge.getCLogger(__name__) async def _init() -> None: async for i in WELCOME_COLLECTION.find({"on": True}): if "mid" not in i: continue WELCOME_CHATS.add(i.get("_id")) async for i in LEFT_COLLECTION.find({"on": True}): if "mid" not in i: continue LEFT_CHATS.add(i.get("_id")) @userge.on_cmd( "setwelcome", about={ "header": "Creates a welcome message in current chat",
import asyncio import os import datetime from typing import List, Dict, Tuple, Optional from emoji import get_emoji_regexp from pyrogram.errors import (FloodWait, UserAdminInvalid, UsernameInvalid, PeerIdInvalid, UserIdInvalid) from pyrogram.types import ChatPermissions, Chat, ChatPrivileges from pyrogram import enums from userge import userge, Message, get_collection, filters from .. import gadmin CHANNEL = userge.getCLogger(__name__) DB = get_collection("BAN_CHANNELS") @userge.on_start async def _init() -> None: async for chat in DB.find(): chat_id = chat['chat_id'] if chat['enabled']: gadmin.ENABLED_CHATS.append(chat_id) if chat['ban']: gadmin.BAN_CHANNELS.append(chat_id) gadmin.ALLOWED[chat_id] = chat['allowed'] channel_delete = filters.create( lambda _, __, query: (query.chat and query.sender_chat and query.chat.id in
# Copyright (C) 2020 by UsergeTeam@Github, < https://github.com/UsergeTeam >. # # This file is part of < https://github.com/UsergeTeam/Userge > project, # and is released under the "GNU v3.0 License Agreement". # Please see < https://github.com/uaudith/Userge/blob/master/LICENSE > # # All rights reserved. import asyncio from pyrogram.errors import PeerIdInvalid from userge import Config, Message, get_collection, userge SAVED_SETTINGS = get_collection("CONFIGS") TRUSTED_SUDO_USERS = get_collection("trusted_sudo_users") SUDO_USERS_COLLECTION = get_collection("sudo_users") SUDO_CMDS_COLLECTION = get_collection("sudo_cmds") async def _init() -> None: s_o = await SAVED_SETTINGS.find_one({"_id": "SUDO_ENABLED"}) if s_o: Config.SUDO_ENABLED = s_o["data"] async for i in SUDO_USERS_COLLECTION.find(): Config.SUDO_USERS.add(i["_id"]) async for i in TRUSTED_SUDO_USERS.find(): Config.TRUSTED_SUDO_USERS.add(i["_id"]) async for i in SUDO_CMDS_COLLECTION.find(): Config.ALLOWED_COMMANDS.add(i["_id"])
# plugin modified for USERGE-X by @Kakashi_HTK(TG)/@ashwinstr(GH) # before porting please ask to Kakashi import asyncio import os from pyrogram import filters from pyrogram.errors import FloodWait, PeerIdInvalid, UserBannedInChannel from userge import Config, Message, get_collection, userge from userge.helpers import extract_id, report_user from userge.plugins.tools.sudo import SAVED_SETTINGS FBAN_LOG_CHANNEL = os.environ.get("FBAN_LOG_CHANNEL") SAVED_SETTINGS = get_collection("CONFIGS") FED_LIST = get_collection("FED_LIST") CHANNEL = userge.getCLogger(__name__) async def _init() -> None: f_t = await SAVED_SETTINGS.find_one({"_id": "FBAN_TAG"}) if f_t: Config.FBAN_TAG = f_t["data"] @userge.on_cmd( "fban_tag", about={ "header": "enable / disable fbanner's tag", "flags": {
MEDIA_TYPE, MEDIA_URL = None, None PATH = "userge/xcache" _CATEGORY = { "admin": "🙋🏻♂️", "fun": "🎨", "misc": "🧩", "tools": "🧰", "utils": "🗂", "unofficial": "➕", "temp": "♻️", "plugins": "💎", "bot": "💠", } # Database SAVED_SETTINGS = get_collection("CONFIGS") BUTTON_BASE = get_collection("TEMP_BUTTON") # TODO use json cache REPO_X = InlineQueryResultArticle( title="Repo", input_message_content=InputTextMessageContent( "**Here's how to setup USERGE-X** "), url="https://github.com/code-rgb/USERGE-X", description="Setup Your Own", thumb_url="https://i.imgur.com/NfIsDQ5.png", reply_markup=InlineKeyboardMarkup([[ InlineKeyboardButton("🔥 USERGE-X Repo", url="https://github.com/code-rgb/USERGE-X"), InlineKeyboardButton( "🚀 Deploy USERGE-X", url=("https://heroku.com/deploy?template=" "https://github.com/code-rgb/USERGE-X/tree/alpha"),
from urllib.parse import unquote from pyrogram.errors import ChatWriteForbidden, ChannelPrivate, ChatIdInvalid from userge import userge, Message, Config, pool, get_collection from userge.utils import time_formatter API_KEY = os.environ.get("FM_API") API_SECRET = os.environ.get("FM_SECRET") USERNAME = os.environ.get("FM_USERNAME") PASSWORD = pylast.md5(os.environ.get("FM_PASSWORD")) CHAT_IDS = [ int(x) for x in os.environ.get("LASTFM_CHAT_ID", str( Config.LOG_CHANNEL_ID)).split() ] LASTFM_DB = get_collection("LASTFM") NOW_PLAYING = [False, None] async def _init(): global NOW_PLAYING # pylint: disable=global-statement k = await LASTFM_DB.find_one({'_id': "LASTFM"}) if k: NOW_PLAYING[0] = bool(k['data']) def check_creds(func): """ decorator for checking creds """ async def checker(msg: Message): if _check_creds(): await func(msg)
from pyrogram import filters from pyrogram.errors import ( BadRequest, FloodWait, Forbidden, MessageIdInvalid, PeerIdInvalid, UserIsBlocked, ) from userge import Config, Message, get_collection, userge from userge.utils import mention_html, time_formatter LOG = userge.getLogger(__name__) CHANNEL = userge.getCLogger(__name__) BOT_BAN = get_collection("BOT_BAN") BOT_START = get_collection("BOT_START") SAVED_SETTINGS = get_collection("CONFIGS") async def _init() -> None: data = await SAVED_SETTINGS.find_one({"_id": "BOT_FORWARDS"}) if data: Config.BOT_FORWARDS = bool(data["is_active"]) allowForwardFilter = filters.create(lambda _, __, ___: Config.BOT_FORWARDS) @userge.on_cmd("bot_fwd", about={"header": "enable / disable Bot Forwards"},
import feedparser import wget from dateutil import parser from pyrogram.errors import (ChatWriteForbidden, ChannelPrivate, UserNotParticipant, ChatIdInvalid) from pyrogram.types import InlineKeyboardMarkup, InlineKeyboardButton from userge import userge, Message, config, logging, get_collection, pool from .. import rss_feed from userge.utils.exceptions import UsergeBotNotFound _LOG = logging.getLogger(__name__) RSS_DICT: Dict[str, List[datetime]] = {} RSS_COLLECTION = get_collection("RSS_FEED") TASK_RUNNING = False @userge.on_start async def _init(): async for i in RSS_COLLECTION.find(): RSS_DICT[i['url']] = [i['published'], None] async def add_new_feed(url: str, l_u: str) -> str: if url in RSS_DICT: out_str = "`Url is matched in Existing Feed Database.`" else: pub, now = _parse_time(l_u) out_str = f"""
import datetime import json import os from uuid import uuid1 from pyrogram import filters from pyrogram.errors import MessageNotModified, UserIsBlocked from pyrogram.types import CallbackQuery, InlineKeyboardButton, InlineKeyboardMarkup from userge import Config, Message, get_collection, userge from userge.utils import mention_html CHANNEL = userge.getCLogger(__name__) PATH = "./userge/xcache/spoiler_db.json" BOT_BAN = get_collection("BOT_BAN") BOT_START = get_collection("BOT_START") class Spoiler_DB: def __init__(self): if not os.path.exists(PATH): d = {} json.dump(d, open(PATH, "w")) self.db = json.load(open(PATH)) def stats_(self, rnd_id: str, user_id: int, user_name: str): if user_id not in Config.OWNER_ID and user_id not in self.db[rnd_id][ "stats"]: self.db[rnd_id]["stats"][user_id] = user_name self.save()
from bson import ObjectId from pyrogram import filters from pyrogram.errors import UserIsBlocked from pyrogram.types import ( CallbackQuery, Chat, ChatPermissions, InlineKeyboardButton, InlineKeyboardMarkup, User, ) from userge import Config, Message, get_collection, userge WARN_DATA = get_collection("WARN_DATA") WARNS_DB = get_collection("WARNS_DB") CHANNEL = userge.getCLogger(__name__) no_input_reply = ( "I don't know who you're talking about, you're going to need to specify a user...!" ) userid_not_valid = "can't get the user!" user_is_admin = "Sorry! I can't warn an Admin" owner_or_sudo = "I can't Ban My Owner and Sudo Users" permission_denied = "You Don't have the permission to do it !" warn_removed = "✅ Warn Removed Successfully" warn_removed_caption = "✅ Warn removed by {} !" no_warns_msg = "Well, {} doesn't have any warns." total_warns_msg = "User {} has {}/{} warnings.\n**Reasons** are:" purge_warns = "{} reset {} warns of {} in {}!"
# and is released under the "GNU v3.0 License Agreement". # Please see < https://github.com/UsergeTeam/Userge/blob/master/LICENSE > # # All rights reserved. import asyncio import shutil import time from pyrogram.types import User from userge import Config, Message, get_collection, userge from userge.core.ext import RawClient from userge.utils import terminate SAVED_SETTINGS = get_collection("CONFIGS") DISABLED_CHATS = get_collection("DISABLED_CHATS") MAX_IDLE_TIME = 300 LOG = userge.getLogger(__name__) CHANNEL = userge.getCLogger(__name__) async def _init() -> None: global MAX_IDLE_TIME # pylint: disable=global-statement d_s = await SAVED_SETTINGS.find_one({"_id": "DYNO_SAVER"}) if d_s: Config.RUN_DYNO_SAVER = bool(d_s["on"]) MAX_IDLE_TIME = int(d_s["timeout"]) disabled_all = await SAVED_SETTINGS.find_one({"_id": "DISABLE_ALL_CHATS"}) if disabled_all:
# Github.com/code-rgb [ TG - @DetetedUser420 ] # Ported it to Pyrogram and improved Heroku compatiblilty import asyncio import os import time import requests import ujson from pyrogram.errors import AboutTooLong, FloodWait from userge import Config, Message, get_collection, userge SP_DATABASE = None # Main DB (Class Database) # Saves Auth data cuz heroku doesn't have persistent storage SPOTIFY_DB = get_collection("SP_DATA") SAVED_SETTINGS = get_collection("CONFIGS") LOG_ = userge.getLogger(__name__) CHANNEL = userge.getCLogger(__name__) USER_INITIAL_BIO = {} # Saves Users Original Bio PATH_ = f"{Config.CACHE_PATH}/spotify_database.json" # [---------------------------] Constants [------------------------------] KEY = "🎶" BIOS = [ KEY + " Vibing : {interpret} - {title}", KEY + " : {interpret} - {title}", KEY + " Vibing : {title}", KEY + " : {title}", ] OFFSET = 1
# This file is part of < https://github.com/UsergeTeam/Userge > project, # and is released under the "GNU v3.0 License Agreement". # Please see < https://github.com/uaudith/Userge/blob/master/LICENSE > # # All rights reserved. import os import base64 from datetime import datetime import aiofiles from userge import userge, Config, Message, get_collection from userge.utils import progress SAVED_SETTINGS = get_collection("CONFIGS") CHANNEL = userge.getCLogger(__name__) async def _init() -> None: data = await SAVED_SETTINGS.find_one({'_id': 'CUSTOM_THUMB'}) if data and not os.path.exists(Config.THUMB_PATH): with open(Config.THUMB_PATH, "wb") as thumb_file: thumb_file.write(base64.b64decode(data['data'])) @userge.on_cmd('sthumb', about={ 'header': "Save thumbnail", 'usage': "{tr}sthumb [reply to any photo]" })
# # This file is part of < https://github.com/UsergeTeam/Userge > project, # and is released under the "GNU v3.0 License Agreement". # Please see < https://github.com/uaudith/Userge/blob/master/LICENSE > # # All rights reserved. import asyncio from typing import Dict, Tuple from pyrogram.errors import BadRequest, Forbidden from userge import Config, Message, get_collection, userge from userge.utils import SafeDict, get_file_id, parse_buttons NOTES_COLLECTION = get_collection("notes") CHANNEL = userge.getCLogger(__name__) SAVED_SETTINGS = get_collection("CONFIGS") NOTES_DATA: Dict[int, Dict[str, Tuple[int, bool]]] = {} def _note_updater(chat_id: int, name: str, message_id: int, is_global: bool) -> None: if chat_id in NOTES_DATA: NOTES_DATA[chat_id].update({name: (message_id, is_global)}) else: NOTES_DATA[chat_id] = {name: (message_id, is_global)} def _note_deleter(chat_id: int, name: str) -> None: if chat_id in NOTES_DATA and name in NOTES_DATA[chat_id]:
from youtubesearchpython import VideosSearch from pyrogram.raw import functions from pyrogram.types import ( InlineKeyboardMarkup, InlineKeyboardButton, CallbackQuery, Message as RawMessage ) from pyrogram.types.messages_and_media.message import Str from pyrogram.errors import MessageDeleteForbidden from userge import userge, Message, pool, filters, get_collection from userge.utils import time_formatter from userge.utils.exceptions import StopConversation CHANNEL = userge.getCLogger(__name__) VC_DB = get_collection("VC_CMDS_TOGGLE") CMDS_FOR_ALL = False MAX_DURATION = int(os.environ.get("MAX_DURATION", 900)) ADMINS = {} PLAYING = False CHAT_NAME = "" CHAT_ID = 0 QUEUE: List[Message] = [] BACK_BUTTON_TEXT = "" CQ_MSG: List[RawMessage] = [] call = GroupCall(userge, play_on_repeat=False)
# # This file is part of < https://github.com/UsergeTeam/Userge > project, # and is released under the "GNU v3.0 License Agreement". # Please see < https://github.com/UsergeTeam/Userge/blob/master/LICENSE > # # All rights reserved import asyncio from pyrogram.errors.exceptions.bad_request_400 import (ChatAdminRequired, UserAdminInvalid, ChannelInvalid) from userge import userge, Message, Config, get_collection GBAN_USER_BASE = get_collection("GBAN_USER") WHITELIST = get_collection("WHITELIST_USER") CHANNEL = userge.getCLogger(__name__) LOG = userge.getLogger(__name__) @userge.on_cmd("gban", about={ 'header': "Globally Ban A User", 'description': "Adds User to your GBan List. " "Bans a Globally Banned user if they join or message. " "[NOTE: Works only in groups where you are admin.]", 'examples': "{tr}gban [userid | reply] [reason for gban] (mandatory)"
""" setup notes """ # Copyright (C) 2020 by UsergeTeam@Github, < https://github.com/UsergeTeam >. # # This file is part of < https://github.com/UsergeTeam/Userge > project, # and is released under the "GNU v3.0 License Agreement". # Please see < https://github.com/uaudith/Userge/blob/master/LICENSE > # # All rights reserved. from userge import userge, Message, get_collection, Config NOTES_COLLECTION = get_collection("notes") @userge.on_cmd("notes", about={'header': "List all saved notes in current chat"}, allow_channels=False) async def view_notes(message: Message) -> None: """ list notes in current chat """ out = '' async for note in NOTES_COLLECTION.find({'chat_id': message.chat.id}, { 'name': 1, 'global': 1 }): out += " 📌 `{}` [**{}**]\n".format( note['name'], 'L' if 'global' in note and not note['global'] else 'G') if out: await message.edit("**--Notes saved in this chat:--**\n\n" + out, del_in=0)
# # All rights reserved. import asyncio import time from random import choice, randint from pyrogram import enums from userge import userge, Message, filters, get_collection from userge.utils import time_formatter, get_custom_import_re pmpermit = get_custom_import_re("userge.plugins.utils.pmpermit", False) CHANNEL = userge.getCLogger(__name__) SAVED_SETTINGS = get_collection("CONFIGS") AFK_COLLECTION = get_collection("AFK") IS_AFK = False IS_AFK_FILTER = filters.create(lambda _, __, ___: bool(IS_AFK)) AFK_INCOMING_FILTER = ( IS_AFK_FILTER & ~filters.me & ~filters.bot & ~filters.service) if pmpermit is not None: AFK_PM_FILTER = (filters.private & ( filters.create( lambda _, __, ___: pmpermit.Dynamic.ALLOW_ALL_PMS) | pmpermit.ALLOWED_CHATS)) AFK_INCOMING_FILTER &= (filters.mentioned | AFK_PM_FILTER) else: AFK_INCOMING_FILTER &= filters.mentioned REASON = '' TIME = 0.0
""" To check User's Info, Is Banned or Not """ from datetime import datetime import requests import spamwatch from userge import Config, Message, get_collection, userge GBAN_USER_BASE = get_collection("GBAN_USER") GMUTE_USER_BASE = get_collection("GMUTE_USER") @userge.on_cmd( "info", about={ "header": "To check User's info", "usage": "{tr}info [for own info]\n" "{tr}info [Username | User Id]\n" "{tr}info [reply to User]", }, allow_via_bot=False, ) async def info(msg: Message): """ To check User's info """ await msg.edit("`Checking...`") user_id = msg.input_str replied = msg.reply_to_message if not user_id: if replied:
from userge import userge, Message, Config, get_collection from pyrogram.types import ( InlineKeyboardMarkup, InlineKeyboardButton, CallbackQuery ) from pyrogram import filters from pyrogram.errors.exceptions import FileIdInvalid, FileReferenceEmpty from pyrogram.errors.exceptions.bad_request_400 import BadRequest from datetime import date import asyncio BOT_START = get_collection("BOT_START") # https://github.com/UsergeTeam/Userge-Assistant/.../alive.py#L41 # refresh file id and file reference from TG server LOGO_ID, LOGO_REF = None, None if Config.BOT_TOKEN and Config.OWNER_ID: if Config.HU_STRING_SESSION: ubot = userge.bot else: ubot = userge @ubot.on_message(filters.private & filters.command("start")) async def start_bot(_, message: Message): bot = await userge.bot.get_me() master = await userge.get_me() u_id = message.from_user.id f_name = message.from_user.first_name
# Copyright (C) 2020 by UsergeTeam@Github, < https://github.com/UsergeTeam >. # # This file is part of < https://github.com/UsergeTeam/Userge > project, # and is released under the "GNU v3.0 License Agreement". # Please see < https://github.com/uaudith/Userge/blob/master/LICENSE > # # All rights reserved. from userge import userge, Message, Filters, get_collection FILTERS_COLLECTION = get_collection("filters") FILTERS_DATA = {} FILTERS_CHATS = Filters.create(lambda _, query: query.chat.id in FILTERS_DATA) def _filter_updater(chat_id: int, name: str, content: str) -> None: if chat_id in FILTERS_DATA: FILTERS_DATA[chat_id].update({name: content}) else: FILTERS_DATA[chat_id] = {name: content} def _filter_deleter(chat_id: int, name: str) -> None: if chat_id in FILTERS_DATA and name in FILTERS_DATA[chat_id]: FILTERS_DATA[chat_id].pop(name) if not FILTERS_DATA[chat_id]: FILTERS_DATA.pop(chat_id)
import re import traceback from pyrogram import filters from pyrogram.types import CallbackQuery, InlineKeyboardButton, InlineKeyboardMarkup from userge import Config, Message, get_collection, userge VOTE = get_collection("VOTES") CHANNEL = userge.getCLogger(__name__) async def _init() -> None: no = 0 async for one in VOTE.find(): no += 1 if no > 20: del_ = no - 20 deleted = 0 async for one in VOTE.find(): await VOTE.delete_one(one) deleted += 1 if deleted == del_: break @userge.on_cmd( "voting", about={ "header": "make voting button",