-
Notifications
You must be signed in to change notification settings - Fork 1
/
broadcast.py
60 lines (54 loc) · 1.84 KB
/
broadcast.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# Yup🙂❤️
#ja na ❤️ day
import os
from telethon import events
from telethon.tl.functions.channels import EditAdminRequest
from telethon.tl.types import ChatAdminRights
from . import *
@bot.on(d3vil_cmd(pattern="gcast ?(.*)"))
async def gcast(event):
if not event.out and not is_fullsudo(event.sender_id):
return await edit_or_reply(event, "`This Command Is Sudo Restricted.`")
xx = event.pattern_match.group(1)
if not xx:
return edit_or_reply(event, "`Give some text to Globally Broadcast`")
tt = event.text
msg = tt[6:]
event = await edit_or_reply(event, "`Globally Broadcasting Msg...`")
er = 0
done = 0
async for x in bot.iter_dialogs():
if x.is_group:
chat = x.id
try:
done += 1
await bot.send_message(chat, msg)
except BaseException:
er += 1
await kk.edit(f"Done in {done} chats, error in {er} chat(s)")
@bot.on(d3vil_cmd(pattern="gucast ?(.*)"))
async def gucast(event):
if not event.out and not is_fullsudo(event.sender_id):
return await edit_or_reply(event, "`This Command Is Sudo Restricted.`")
xx = event.pattern_match.group(1)
if not xx:
return edit_or_reply(event, "`Give some text to Globally Broadcast`")
tt = event.text
msg = tt[7:]
kk = await edit_or_reply(event, "`Globally Broadcasting Msg...`")
er = 0
done = 0
async for x in bot.iter_dialogs():
if x.is_user and not x.entity.bot:
chat = x.id
try:
done += 1
await bot.send_message(chat, msg)
except BaseException:
er += 1
await kk.edit(f"Done in {done} chats, error in {er} chat(s)")
CmdHelp("broadcast").add_command(
"gucast", "use & see"
).add_command(
"gcast", "Globally Bordcasting your msg"
).add()