Giter VIP home page Giter VIP logo

userbot's Introduction

Pyrogram Userbot

Python Version Repo Size Commit Activity Codacy Badge HitCount Contributors Last Commit Issues Pull Requests License

A Telegram Userbot based on Pyrogram

This repository contains the source code of a Telegram Userbot and the instructions for running a copy yourself. Beside its main purpose, the bot is featuring Pyrogram Asyncio and Smart Plugins; feel free to explore the source code to learn more about these topics.

I assume you will read this whole README.md file before continuing.

Requirements

You're gonna need to get the following programs and services either installed on your server or signed up for. You must do all. It is a cardinal sin if you don't.

  • Python 3.10 (requirements were generated for 3.10. Python 3.8 is supported from the looks of it.)

  • virtualenv installed so that the packages don't interfere with other system packages.

  • MongoDB on your server or a free server from MongoDB Atlas. (I recommend Atlas as I used it during development with no issues.)

  • carbon-now-cli on your server too generate code images for the carbon.py module. I use this CLI tool cause I don't know and couldn't get selenium and chromedriver to work nicely on my server/code. I'll be nice and even give you the command to install this. I assume you already have NPM installed.

    Windows: npm install -g carbon-now-cli
    Linux: sudo npm install -g carbon-now-cli --unsafe-perm=true --allow-root
    MacOS: I assume almost the same as linux ¯\_(ツ)_/¯
    

Installation and Deployment

The way I deploy

git clone https://github.com/athphane/userbot.git
cd userbot
virtualenv venv
source venv/bin/activate
pip install -r requirements.txt
python -m userbot

Using docker

  • Save the following content as docker-compose.yml
version: '3.5'
services:
  userbot:
    hostname: userbot
    volumes:
      - ./config:/root/userbot/config
    image: ghcr.io/athphane/userbot:latest
  • First run:
docker compose run --rm userbot python -m userbot
  • Configure userbot and stop container CTRL+C
  • Run the container again de-attached:
docker compose up -d

Spotify integration

To get the Spotify commands working on the Userbot, you need to get a CLIENT_ID and CLIENT_SECRET form the Spotify Developer Portal and add them into your userbot.ini file.

On the Spotify developer portal, make sure to set your application Redirect URI to 'http://localhost:8888/callback'.

Now is a good time Then go ahead and run the command python spotify.py in the projects root directory.

This will create a file called .cache-yourusername. You need to transfer this file to the project root of the server that will be running your userbot. This is a one time setup.

Known issues

Star History

Star History Chart

Credits, and Thanks to


Made with love from the Maldives ❤

userbot's People

Contributors

athphane avatar codacy-badger avatar customicon avatar deepsource-autofix[bot] avatar deepsourcebot avatar dependabot[bot] avatar dharisd avatar i701 avatar phoenixatom avatar shihaamabr avatar tiashe avatar wovencoast avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

userbot's Issues

[BUG] config file is no longer supported in Pyrogram

python -m userbot
Traceback (most recent call last):
File "C:\Users\root\AppData\Local\Programs\Python\Python39\lib\runpy.py", line 188, in _run_module_as_main mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
File "C:\Users\root\AppData\Local\Programs\Python\Python39\lib\runpy.py", line 147, in _get_module_details return _get_module_details(pkg_main_name, error)
File "C:\Users\root\AppData\Local\Programs\Python\Python39\lib\runpy.py", line 111, in get_module_details import(pkg_name)
File "C:\Users\root\Documents\userbot\userbot_init
.py", line 37, in e> UserBot = UserBot(version)
File "C:\Users\root\Documents\userbot\userbot\userbot.py", line 22, in _init _ super().init(
TypeError: init() got an unexpected keyword argument 'config_file'

Originally posted by @OcroCodeChain in #56 (comment)

Mango DB

Hi there,

Thanks for your userbot. I am currently having a few issues with Mango DB. I am unsure how to connect using the Mango DB Atlas. I do have a cluster but all I get is a connection URL rather than what you show in your config file:
[mongo] url = localhost db_name = userbot db_username = db_password =

Id appreciate it if you could help me out where I can find those.

Thank you!

No section name mongo

File "/usr/lib/python3.9/runpy.py", line 188, in _run_module_as_main
mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
File "/usr/lib/python3.9/runpy.py", line 147, in _get_module_details
return _get_module_details(pkg_main_name, error)
File "/usr/lib/python3.9/runpy.py", line 111, in _get_module_details
import(pkg_name)
File "/root/userbot/userbot/init.py", line 45, in
MONGO_URL = config.get("mongo", "url")
File "/usr/lib/python3.9/configparser.py", line 781, in get
d = self._unify_values(section, vars)
File "/usr/lib/python3.9/configparser.py", line 1149, in _unify_values
raise NoSectionError(section) from None
configparser.NoSectionError: No section: 'mongo'
Immagine 2021-06-09 100336

What is the functional of this bot?

I've reviewed the repository and readme.py but couldn't locate details regarding the application's purpose, the commands available for the userbot, or specific use cases for a Telegram userbot. Could you please direct me to resources or documentation where I can find more information on these topics?

Error

PermissionError: [Errno 13] Permission denied: '/proc/stat'

virtual venv error

Command:

virtual venv

Error:

Running virtualenv with interpreter /root/userbot/venv/bin/python2 Please use the *system* python to run this script Traceback (most recent call last): File "/usr/lib/python3/dist-packages/virtualenv.py", line 2379, in <module> main() File "/usr/lib/python3/dist-packages/virtualenv.py", line 724, in main symlink=options.symlink) File "/usr/lib/python3/dist-packages/virtualenv.py", line 950, in create_environment site_packages=site_packages, clear=clear, symlink=symlink)) File "/root/userbot/venv/lib/python2.7/posixpath.py", line 367, in abspath if not isabs(path): File "/root/userbot/venv/lib/python2.7/posixpath.py", line 54, in isabs return s.startswith('/') AttributeError: 'NoneType' object has no attribute 'startswith'

AFK improvement

I think it would be a great addition if AFK is Auto being disabled if you send a message again after the .afk issued command. I sometimes simply forget to type !afk.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.