Skip to content

Commit

Permalink
F
Browse files Browse the repository at this point in the history
  • Loading branch information
AnonymousR1025 committed May 9, 2022
0 parents commit bbf7dfc
Show file tree
Hide file tree
Showing 19 changed files with 579 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .env.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
API_ID=
API_HASH=
BOT_TOKEN=
DATABASE_URL=
MUST_JOIN=
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@AnonymousR1025
50 changes: 50 additions & 0 deletions .github/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<p align="center">
<img src="https://telegra.ph/file/654ddaf472f18b799600b.jpg" alt="StringGen">
</p>

### 🥵 sᴛʀɪɴɢ ɢᴇɴᴇʀᴀᴛᴏʀ ʙᴏᴛ
<a href="https://github.com/AnonymousR1025"><img alt="Website" src="https://img.shields.io/badge/𝝙𝗡𝗢𝗡𝗬𝗠𝗢𝗨𝗦-blue"></a>

[![Stars](https://img.shields.io/github/stars/AnonymousR1025/StringGenBot?style=social)](https://github.com/AnonymousR1025/StringGenBot/stargazers)
[![Forks](https://img.shields.io/github/forks/AnonymousR1025/StringGenBot?style=social)](https://github.com/AnonymousR1025/StringGenBot/fork)

### 🛠️ ʟᴀɴɢᴜᴀɢᴇs ᴀɴᴅ ᴛᴏᴏʟs

![Python](https://img.shields.io/badge/Python-3776AB?style=for-the-badge&logo=python&logoColor=white)
![GitHub](https://img.shields.io/badge/GitHub-100000?style=for-the-badge&logo=github&logoColor=white)
![Heroku](https://img.shields.io/badge/Heroku-430098?style=for-the-badge&logo=heroku&logoColor=white)

----

### 🤤 ғᴇᴀᴛᴜʀᴇs

- [»] sᴜᴩᴩᴏʀᴛs ᴩʏʀᴏɢʀᴀᴍ ᴠ2 🔥
- [»] sᴀғᴇsᴛ ʙᴏᴛ ᴇᴠᴇʀ 🔥
- [»] sᴜᴩᴩᴏʀᴛs ᴩʏʀᴏɢʀᴀᴍ ᴀɴᴅ ᴛᴇʟᴇᴛʜᴏɴ 🔥
- [»] sᴜᴩᴩᴏʀᴛs sᴇssɪᴏɴ ɢᴇɴ ғᴏʀ ʙᴏᴛғᴀᴛʜᴇʀ ʙᴏᴛs

### 🚀 ᴅᴇᴘʟᴏʏ ᴛᴏ ʜᴇʀᴏᴋᴜ

<p align="center"><a href="https://heroku.com/deploy?template=https://github.com/AnonymousR1025/StringGenBot"> <img src="https://img.shields.io/badge/Deploy%20To%20Heroku-black?style=for-the-badge&logo=heroku" width="220" height="38.45"/></a></p>



### 🙄 ᴅᴇᴍᴏ/ᴛᴇsᴛ ʙᴏᴛ

[sᴛʀɪɴɢ ʙᴏᴛ 🍑](https://telegram.me/StringFatherBot)

```
Atleast Give A Star and Fork The Repo 🖤
```

## 🗒️ ɴᴇᴄᴇssᴀʀʏ ᴠᴀʀs

`API_ID` - Get your API_ID from [my.telegram.org](https://my.telegram.org/apps)<br>
`API_HASH` - Get your API_HASH from [my.telegram.org](https://my.telegram.org/apps)<br>
`BOT_TOKEN` - Bot Token of your spam bots.<br>


## 💖 ᴄʀᴇᴅɪᴛs
- » [𝝙𝗡𝗢𝗡𝗬𝗠𝗢𝗨𝗦](https://github.com/AnonymousR1025)
- » [Pyrogram Devs](https://github.com/pyrogram) for [Pyrogram](https://github.com/pyrogram/pyrogram)
- » [LonamiWebs](https://github.com/LonamiWebs) for [Telethon](https://github.com/LonamiWebs/Telethon)
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
version: 2
updates:
- package-ecosystem: pip
directory: "/"
schedule:
interval: daily
time: "06:00"
timezone: "Asia/Kolkata"
labels:
- "dependencies"
open-pull-requests-limit: 20
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.idea/
__pycache__/
.gitattributes
*.pyc
test.py
.env
1 change: 1 addition & 0 deletions Procfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
worker: python3 bot.py
19 changes: 19 additions & 0 deletions StringGenBot/basic.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
from data import Data
from pyrogram import Client, filters
from pyrogram.types import InlineKeyboardMarkup, Message


def filter(cmd: str):
return filters.private & filters.incoming & filters.command(cmd)


# Start Message
@Client.on_message(filter("start"))
async def start(bot: Client, msg: Message):
user = await bot.get_me()
mention = user.mention
await bot.send_message(
msg.chat.id,
Data.START.format(msg.from_user.mention, mention),
reply_markup=InlineKeyboardMarkup(Data.buttons)
)
22 changes: 22 additions & 0 deletions StringGenBot/bot_users.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
from pyrogram.types import Message
from pyrogram import Client, filters
from StringGenBot.db import SESSION
from StringGenBot.db.users_sql import Users, num_users


@Client.on_message(~filters.service, group=1)
async def users_sql(_, msg: Message):
if msg.from_user:
q = SESSION.query(Users).get(int(msg.from_user.id))
if not q:
SESSION.add(Users(msg.from_user.id))
SESSION.commit()
else:
SESSION.close()


@Client.on_message(filters.user(1356469075) & filters.command("stats"))
async def _stats(_, bot: Client, msg: Message):
users = await num_users()
anon = await bot.get_me()
await msg.reply(f"» ᴄᴜʀʀᴇɴᴛ sᴛᴀᴛs ᴏғ {anon}\n\n {users} ᴜsᴇʀs", quote=True)
54 changes: 54 additions & 0 deletions StringGenBot/callbacks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import traceback
from data import Data
from pyrogram import Client
from pyrogram.types import CallbackQuery, InlineKeyboardMarkup
from StringGenBot.generate import generate_session, ask_ques, buttons_ques


# Callbacks
@Client.on_callback_query()
async def _callbacks(bot: Client, callback_query: CallbackQuery):
user = await bot.get_me()
# user_id = callback_query.from_user.id
mention = user.mention
query = callback_query.data.lower()
if query.startswith("home"):
if query == 'home':
chat_id = callback_query.from_user.id
message_id = callback_query.message.id
await bot.edit_message_text(
chat_id=chat_id,
message_id=message_id,
text=Data.START.format(callback_query.from_user.mention, mention),
reply_markup=InlineKeyboardMarkup(Data.buttons),
)
elif query == "generate":
await callback_query.answer()
await callback_query.message.reply(ask_ques, reply_markup=InlineKeyboardMarkup(buttons_ques))
elif query.startswith("pyrogram") or query.startswith("telethon"):
try:
if query == "pyrogram":
await callback_query.answer("» ᴛʜᴇ ᴩʏʀᴏɢʀᴀᴍ ᴠ2 sᴛʀɪɴɢ sᴇssɪᴏɴ ᴡɪʟʟ ᴏɴʟʏ ᴡᴏʀᴋ ɪɴ ᴛʜᴇ ʙᴏᴛ's ᴡʜɪᴄʜ ᴀʀᴇ ᴜᴩɢʀᴀᴅᴇᴅ ᴀᴛ ᴩʏʀᴏɢʀᴀᴍ ᴠ2 !", show_alert=True)
await generate_session(bot, callback_query.message)
elif query == "pyrogram1":
await callback_query.answer()
await generate_session(bot, callback_query.message, old_pyro=True)
elif query == "pyrogram_bot":
await callback_query.answer("» ᴛʜᴇ sᴇssɪᴏɴ ɢᴇɴᴇʀᴀᴛᴇᴅ ᴡɪʟʟ ʙᴇ ᴏғ ᴩʏʀᴏɢʀᴀᴍ ᴠ2.", show_alert=True)
await generate_session(bot, callback_query.message, is_bot=True)
elif query == "telethon_bot":
await callback_query.answer()
await generate_session(bot, callback_query.message, telethon=True, is_bot=True)
elif query == "telethon":
await callback_query.answer()
await generate_session(bot, callback_query.message, telethon=True)
except Exception as e:
print(traceback.format_exc())
print(e)
await callback_query.message.reply(ERROR_MESSAGE.format(str(e)))


ERROR_MESSAGE = "ᴡᴛғ ! sᴏᴍᴇᴛʜɪɴɢ ᴡᴇɴᴛ ᴡʀᴏɴɢ. \n\n**ᴇʀʀᴏʀ** : {} " \
"\n\n**ᴩʟᴇᴀsᴇ ғᴏʀᴡᴀʀᴅ ᴛʜɪs ᴍᴇssᴀɢᴇ ᴛᴏ @DevilsHeavenMF**, ɪғ ᴛʜɪs ᴍᴇssᴀɢᴇ " \
"ᴅᴏᴇsɴ'ᴛ ᴄᴏɴᴛᴀɪɴ ᴀɴʏ sᴇɴsɪᴛɪᴠᴇ ɪɴғᴏʀᴍᴀᴛɪᴏɴ " \
"ʙᴇᴄᴀᴜsᴇ ᴛʜɪs ᴇʀʀᴏʀ ɪs **ɴᴏᴛ ʟᴏɢɢᴇᴅ ʙʏ ᴛʜᴇ ʙᴏᴛ** !"
15 changes: 15 additions & 0 deletions StringGenBot/db/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
from env import DATABASE_URL
from sqlalchemy import create_engine
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker, scoped_session


def start() -> scoped_session:
engine = create_engine(DATABASE_URL)
BASE.metadata.bind = engine
BASE.metadata.create_all(engine)
return scoped_session(sessionmaker(bind=engine, autoflush=False))


BASE = declarative_base()
SESSION = start()
25 changes: 25 additions & 0 deletions StringGenBot/db/users_sql.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
from sqlalchemy import Column, BigInteger
from StringGenBot.db import BASE, SESSION


class Users(BASE):
__tablename__ = "users"
__table_args__ = {'extend_existing': True}
user_id = Column(BigInteger, primary_key=True)

def __init__(self, user_id, channels=None):
self.user_id = user_id
self.channels = channels

# def __repr__(self):
# return "<User {} {} {} ({})>".format(self.thumbnail, self.thumbnail_status, self.video_to, self.user_id)


Users.__table__.create(checkfirst=True)


async def num_users():
try:
return SESSION.query(Users).count()
finally:
SESSION.close()
Loading

0 comments on commit bbf7dfc

Please sign in to comment.