Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ikut botny om #78

Open
wants to merge 17 commits into
base: sql-extended
Choose a base branch
from
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ FROM sahyam/docker:groovy
#
# Clone repo and prepare working directory
#
RUN git clone -b sql-extended https://github.com/sahyam2019/oub-remix /root/userbot
RUN git clone -b sql-extended https://github.com/prooholic/oub-remix /root/userbot
RUN mkdir /root/userbot/.bin
WORKDIR /root/userbot

#Install python requirements
RUN pip3 install -r https://raw.githubusercontent.com/sahyam2019/oub-remix/sql-extended/requirements.txt
RUN pip3 install -r https://raw.githubusercontent.com/prooholic/oub-remix/sql-extended/requirements.txt

CMD ["python3","-m","userbot"]
3 changes: 1 addition & 2 deletions userbot/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@
LOGS.info(f"You are running oub-remix [{BOT_VER}]")

LOGS.info(
"Congratulations, your userbot is now running !! Test it by typing .start/.ping in any chat."
"\nIf you need assistance, head to https://t.me/remixsupport")
"Congratulations, your userbot is now running !! Test it by typing .start/.ping in any chat.")



Expand Down
2 changes: 1 addition & 1 deletion userbot/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def register(**args):
pattern = args.get('pattern', None)
disable_edited = args.get('disable_edited', True)
ignore_unsafe = args.get('ignore_unsafe', False)
unsafe_pattern = r'^[^/!#@\$A-Za-z]'
unsafe_pattern = r'^[^/!#@:,;?\$A-Za-z]'
groups_only = args.get('groups_only', False)
trigger_on_fwd = args.get('trigger_on_fwd', False)
disable_errors = args.get('disable_errors', False)
Expand Down
1 change: 1 addition & 0 deletions userbot/modules/coolprofilepics.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,3 +123,4 @@ async def main(event):
os.system("rm -rf donottouch.jpg")

await asyncio.sleep(3600) #Edit this to your required needs

6 changes: 1 addition & 5 deletions userbot/modules/gdrive.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,11 +286,9 @@ async def download(gdrive, service, uri=None):
return reply
else:
reply += (
f"`{status}`\n\n"
f"`Name :` `{file_name}`\n"
f"`Size :` `{humanbytes(result[0])}`\n"
f"`Link :` [{file_name}]({result[1]})\n"
"`Status :` **OK** - Successfully uploaded.\n\n"
)
return reply
else:
Expand Down Expand Up @@ -530,11 +528,9 @@ async def download_gdrive(gdrive, service, uri):
)
else:
reply += (
"`[FILE - UPLOAD]`\n\n"
f"`Name :` `{file_name}`\n"
f"`Size :` `{humanbytes(result[0])}`\n"
f"`Link :` [{file_name}]({result[1]})\n"
"`Status :` **OK**\n\n"
)
return reply
else:
Expand Down Expand Up @@ -1144,7 +1140,7 @@ async def google_drive(gdrive):
)
if result:
await gdrive.respond(
"`[FILE - UPLOAD]`\n\n"
"`FILE - UPLOAD`\n\n"
f"`Name :` `{file_name}`\n"
f"`Size :` `{humanbytes(result[0])}`\n"
f"`Link :` [{file_name}]({result[1]})\n"
Expand Down
7 changes: 7 additions & 0 deletions userbot/modules/memes.py
Original file line number Diff line number Diff line change
Expand Up @@ -1435,6 +1435,13 @@ async def nih(e):
"`\n(●_●)`"
"`\n🌹<\ *Now give it back`")

@register(outgoing=True, pattern="^.tisu$")
async def tisu(e):
if not e.text[0].isalpha() and e.text[0] not in ("/", "#", "@", "!"):
await e.edit("`\n{\__/}`"
"`\n( • . •)`"
"`\n/ >🇮🇱 Nih Tisu buat berak`"
"`\n `")

@register(outgoing=True, pattern="^.fag$")
async def gtfo(e):
Expand Down
2 changes: 1 addition & 1 deletion userbot/modules/remixmisc.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ async def apk(e):
app_details += "\n\n<code>Developer :</code> <a href='"+app_dev_link+"'>"+app_dev+"</a>"
app_details += "\n<code>Rating :</code> "+app_rating.replace("Rated ", "⭐ ").replace(" out of ", "/").replace(" stars", "", 1).replace(" stars", "⭐ ").replace("five", "5")
app_details += "\n<code>Features :</code> <a href='"+app_link+"'>View in Play Store</a>"
app_details += "\n\n===> @heyw𝖔rld <==="
app_details += "\n\n===> `@Prooholic` <==="
await e.edit(app_details, link_preview = True, parse_mode = 'HTML')
except IndexError:
await e.edit("No result found in search. Please enter **Valid app name**")
Expand Down
17 changes: 9 additions & 8 deletions userbot/modules/system_stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,15 +222,16 @@ async def amireallyalive(alive):
""" For .start command, check if the bot is running. """
logo = ALIVE_LOGO
uptime = await get_readable_time((time.time() - StartTime))
output = (f"`🤖 STATUS: Remix is running ✅`\n"
f"`Telethon version`: {version.__version__} \n"
f"`Python version🐍`: {python_version()} \n"
f"`Bot Version🤘: Remix {BOT_VER}` \n"
output = (f"`Hi, Oub-remix here!`\n"
f"==================================== \n"
f"`User 👨‍🚀`: {DEFAULTUSER} \n"
f"`Maintainer 🏄‍♂️`: @heyworld \n"
f"`Bot Uptime ⏱️`: {uptime} \n"
f"====================================\n")
f"`Telethon` {version.__version__} \n"
f"`Python` {python_version()} \n"
f"`Bot Version {BOT_VER}` \n"
f"==================================== \n"
f"`Owner`: {DEFAULTUSER} \n"
f"`Uptime Since` {uptime} Ago\n"
f"====================================\n"
f"`Stay Safe, Covid-19 Everywhere!\n")
if ALIVE_LOGO:
try:
logo = ALIVE_LOGO
Expand Down
165 changes: 165 additions & 0 deletions userbot/modules/welcomes.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
from userbot.events import register
from userbot import CMD_HELP, bot, LOGS, CLEAN_WELCOME, BOTLOG_CHATID
from telethon.events import ChatAction


@bot.on(ChatAction)
async def welcome_to_chat(event):
try:
from userbot.modules.sql_helper.welcome_sql import get_current_welcome_settings
from userbot.modules.sql_helper.welcome_sql import update_previous_welcome
except AttributeError:
return
cws = get_current_welcome_settings(event.chat_id)
if cws:
"""user_added=True,
user_joined=True,
user_left=False,
user_kicked=False"""
if (event.user_joined
or event.user_added) and not (await event.get_user()).bot:
if CLEAN_WELCOME:
try:
await event.client.delete_messages(event.chat_id,
cws.previous_welcome)
except Exception as e:
LOGS.warn(str(e))
a_user = await event.get_user()
chat = await event.get_chat()
me = await event.client.get_me()

title = chat.title if chat.title else "this chat"
participants = await event.client.get_participants(chat)
count = len(participants)
mention = "[{}](tg://user?id={})".format(a_user.first_name,
a_user.id)
my_mention = "[{}](tg://user?id={})".format(me.first_name, me.id)
first = a_user.first_name
last = a_user.last_name
if last:
fullname = f"{first} {last}"
else:
fullname = first
username = f"@{a_user.username}" if a_user.username else mention
userid = a_user.id
my_first = me.first_name
my_last = me.last_name
if my_last:
my_fullname = f"{my_first} {my_last}"
else:
my_fullname = my_first
my_username = f"@{me.username}" if me.username else my_mention
file_media = None
current_saved_welcome_message = None
if cws and cws.f_mesg_id:
msg_o = await event.client.get_messages(entity=BOTLOG_CHATID,
ids=int(cws.f_mesg_id))
file_media = msg_o.media
current_saved_welcome_message = msg_o.message
elif cws and cws.reply:
current_saved_welcome_message = cws.reply
current_message = await event.reply(
current_saved_welcome_message.format(mention=mention,
title=title,
count=count,
first=first,
last=last,
fullname=fullname,
username=username,
userid=userid,
my_first=my_first,
my_last=my_last,
my_fullname=my_fullname,
my_username=my_username,
my_mention=my_mention),
file=file_media)
update_previous_welcome(event.chat_id, current_message.id)


@register(outgoing=True, pattern=r"^.setwelcome(?: |$)(.*)")
async def save_welcome(event):
try:
from userbot.modules.sql_helper.welcome_sql import add_welcome_setting
except AttributeError:
await event.edit("`Running on Non-SQL mode!`")
return
msg = await event.get_reply_message()
string = event.pattern_match.group(1)
msg_id = None
if msg and msg.media and not string:
if BOTLOG_CHATID:
await event.client.send_message(
BOTLOG_CHATID, f"#WELCOME_NOTE\
\nCHAT ID: {event.chat_id}\
\nThe following message is saved as the new welcome note for the chat, please do NOT delete it !!"
)
msg_o = await event.client.forward_messages(
entity=BOTLOG_CHATID,
messages=msg,
from_peer=event.chat_id,
silent=True)
msg_id = msg_o.id
else:
await event.edit(
"`Saving media as part of the welcome note requires the BOTLOG_CHATID to be set.`"
)
return
elif event.reply_to_msg_id and not string:
rep_msg = await event.get_reply_message()
string = rep_msg.text
success = "`Welcome note {} for this chat.`"
if add_welcome_setting(event.chat_id, 0, string, msg_id) is True:
await event.edit(success.format('saved'))
else:
await event.edit(success.format('updated'))


@register(outgoing=True, pattern="^.checkwelcome$")
async def show_welcome(event):
try:
from userbot.modules.sql_helper.welcome_sql import get_current_welcome_settings
except AttributeError:
await event.edit("`Running on Non-SQL mode!`")
return
cws = get_current_welcome_settings(event.chat_id)
if not cws:
await event.edit("`No welcome message saved here.`")
return
elif cws and cws.f_mesg_id:
msg_o = await event.client.get_messages(entity=BOTLOG_CHATID,
ids=int(cws.f_mesg_id))
await event.edit(
"`I am currently welcoming new users with this welcome note.`")
await event.reply(msg_o.message, file=msg_o.media)
elif cws and cws.reply:
await event.edit(
"`I am currently welcoming new users with this welcome note.`")
await event.reply(cws.reply)


@register(outgoing=True, pattern="^.rmwelcome$")
async def del_welcome(event):
try:
from userbot.modules.sql_helper.welcome_sql import rm_welcome_setting
except AttributeError:
await event.edit("`Running on Non-SQL mode!`")
return
if rm_welcome_setting(event.chat_id) is True:
await event.edit("`Welcome note deleted for this chat.`")
else:
await event.edit("`Do I have a welcome note here ?`")


CMD_HELP.update({
"welcome":
"\
.setwelcome <welcome message> or reply to a message with .setwelcome\
\nUsage: Saves the message as a welcome note in the chat.\
\n\nAvailable variables for formatting welcome messages :\
\n`{mention}, {title}, {count}, {first}, {last}, {fullname}, {userid}, {username}, {my_first}, {my_fullname}, {my_last}, {my_mention}, {my_username}`\
\n\n.checkwelcome\
\nUsage: Check whether you have a welcome note in the chat.\
\n\n.rmwelcome\
\nUsage: Deletes the welcome note for the current chat.\
"
})