Skip to content

Instantly share code, notes, and snippets.

View daviddanielng's full-sized avatar
✍️
Writing lines

Daniel Enubiaka daviddanielng

✍️
Writing lines
View GitHub Profile
import logging
from pathlib import Path
import os, sys
import asyncio
from telegram.request import HTTPXRequest
from telegram import Bot, Message, MessageId
from telegram.error import RetryAfter
from simpletap.utils.service import Service
@daviddanielng
daviddanielng / is_member_of_group.py
Last active June 23, 2024 22:05
Python Telegram Bot (PTB) check if user if a user is subscribed or a member of a group
async def __is_member_of_group(self, userId: int, bot: Bot) -> bool:
try:
aa = await bot.get_chat_member("groupIdOrUsername", user_id=userId)
status = aa.status.lower()
match status:
case "member" | "administrator" | "owner" | "creator":
return True
case "restricted":
await bot.send_message(
@daviddanielng
daviddanielng / bypass_devtools_detect.md
Last active June 12, 2024 09:07
How to stop sites from detecting you in dev tools.

HOW TO STOP SITES FROM DETECTING YOU IN DEV TOOL ON LINUX, WINDOWS AND MACOS.

I will make this brief: utilising devtools is prohibited on some websites (typically shady websites) for users like you and me. I am writing this description to show you how I was able to navigate with a little bit of Google and redditing. None of the standard browsers Firefox, Google Chrome, Safari, or any other will be able to use this, save from the one I am about to disclose. You need to download LibreWolf; it is a special browser that makes use of the firefox gecko render engine and gives you the ability to change the necessary browser settings.

HOW TO INSTALL LIBREWOLF ON YOUR OS

To install librewolf on your OS see link below

import logging
from pathlib import Path
import os, sys
import asyncio
from telegram.request import HTTPXRequest
from telegram import Bot, Message
from utils.service import Service
from utils.log import setup
def get_bot_queue_wait(self, name):
max_request = int(os.getenv("BOT_MAX_REQUEST", 0))
max_time = int(os.getenv("BOT_MAX_TIME", 0))
current_time = datetime.datetime.now().timestamp()
max_wait = max_time / max_request
re = 12
if max_request > 0 and max_time > 0:
def read_file():
file = open(self.queue_file, "r")
@daviddanielng
daviddanielng / mal_token.sh
Created May 5, 2024 12:06 — forked from ponsfrilus/mal_token.sh
Bash script to retreive a MyAnimeList (MAL) API access Token
#!/usr/bin/env bash
#
# Simplify the TOKEN generation for the My Anime List API (MAL API).
#
# Link to this file: https://gist.github.com/ponsfrilus/5fa501752595c972f568b61fb192e8b5
#
# Usage:
# export MAL_CLIENT_ID='phiequ3nah4phohqu7aephae5va8eePu' MAL_CLIENT_SECRET='oof1EilohLaimeigi5eithei0Johlai4hud2EiTee8Ien3iRieTouSeiv1phaiti';
# ./mal_token.sh [--refresh]
# Note: these are pwgen generated, they won't work.
Traceback (most recent call last):
File "/home/codespace/.local/share/virtualenvs/simpletap-WA04qNPT/lib/python3.10/site-packages/telegram/request/_httpxrequest.py", line 276, in do_request
res = await self._client.request(
File "/home/codespace/.local/share/virtualenvs/simpletap-WA04qNPT/lib/python3.10/site-packages/httpx/_client.py", line 1574, in request
return await self.send(request, auth=auth, follow_redirects=follow_redirects)
File "/home/codespace/.local/share/virtualenvs/simpletap-WA04qNPT/lib/python3.10/site-packages/httpx/_client.py", line 1661, in send
response = await self._send_handling_auth(
File "/home/codespace/.local/share/virtualenvs/simpletap-WA04qNPT/lib/python3.10/site-packages/httpx/_client.py", line 1689, in _send_handling_auth
response = await self._send_handling_redirects(
File "/home/codespace/.local/share/virtualenvs/simpletap-WA04qNPT/lib/python3.10/site-packages/httpx/_client.py", line 1726, in _send_handling_redirects
def start():
# application = ApplicationBuilder().token()
conf = Conf("/workspaces/MAS-Oasis/bot/confg.json")
application = ApplicationBuilder().token(conf.get_settings("token")).build()
application.add_handler(CommandHandler(
"support", how_to_support))
application.add_handler(CommandHandler(
"start", listen_for_start, filters=filters.ChatType.SUPERGROUP))