Skip to content

Commit

Permalink
Merge pull request #9 from TheTeamAlexa/autofix
Browse files Browse the repository at this point in the history
Format code.
  • Loading branch information
TheTeamAlexa authored Jan 13, 2024
2 parents dffc3f5 + 34aacfe commit 0455dfb
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions StringSessionBot/gcast.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,18 @@
from pyrogram.types import InlineKeyboardMarkup, Message

# Initialize the database
db = pickledb.load('user_db.db', False)
db = pickledb.load("user_db.db", False)


# Filters to use command
def filter(cmd: str):
return filters.private & filters.incoming & filters.command(cmd)


# Owner id
owner_id = 6174058850


# Start Message
@Client.on_message(filter("start"))
async def start(bot: Client, msg: Message): # Corrected 'message' to 'msg'
Expand All @@ -29,6 +32,7 @@ async def start(bot: Client, msg: Message): # Corrected 'message' to 'msg'
reply_markup=InlineKeyboardMarkup(Data.buttons),
)


@Client.on_message(filters.command("gcast") & filters.private)
async def gcast_command(client, message):
if message.from_user.id == owner_id:
Expand All @@ -37,14 +41,17 @@ async def gcast_command(client, message):
else:
await message.reply_text("You are not authorized to use this command.")


async def handle_broadcast(client, message):
users = db.getall()
delivered_count = 0

for user_id in users:
try:
user_id = int(user_id)
await client.send_message(user_id, "Broadcast message By @TheTeamAlexa: " + message.text)
await client.send_message(
user_id, "Broadcast message By @TheTeamAlexa: " + message.text
)
delivered_count += 1
except ValueError:
pass
Expand Down

0 comments on commit 0455dfb

Please sign in to comment.