blaah nothing

pull/16/head
Shrimadhav U K 2018-08-06 18:30:07 +05:30
parent c3f10a0fc7
commit c15508885a
9 changed files with 119 additions and 2 deletions

View File

@ -12,6 +12,16 @@
"ENV": {
"description": "Setting this to ANYTHING will enable env variables. But, you need to understand the code to know what to set here!",
"value": "ANYTHING"
},
"OPEN_WEATHER_MAP_APPID": {
"description": "Get your own APPID from https://api.openweathermap.org/data/2.5/weather",
"value": "",
"required": false
},
"SCREEN_SHOT_LAYER_ACCESS_KEY": {
"description": "Get your own ACCESS_KEY from http://api.screenshotlayer.com/api/capture",
"value": "",
"required": false
}
},
"addons": []

View File

@ -1,3 +1,5 @@
regex
urbandict
requests
Pillow

11
stdplugins/help.py Normal file
View File

@ -0,0 +1,11 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from telethon import events
@borg.on(events.NewMessage(pattern=r".helpme", outgoing=True))
async def _(event):
if event.fwd_from:
return
await event.edit('UserBot Powered by https://github.com/uniborg/uniborg')

18
stdplugins/json.py Normal file
View File

@ -0,0 +1,18 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from telethon import events
@borg.on(events.NewMessage(pattern=r"\.json", outgoing=True))
async def _(event):
if event.fwd_from:
return
if event.reply_to_msg_id:
message_id = event.reply_to_msg_id
previous_message = await borg.get_messages(event.chat_id, limit=1, max_id=message_id+1, min_id=message_id-1)
await event.edit(previous_message[0].stringify())
else:
await event.edit(event.stringify())

View File

@ -17,6 +17,7 @@ async def _(event):
p = await borg.get_participants(event.chat_id, aggressive=True)
await event.edit("Searching through {} users for deleted accounts ...".format(len(p)))
c = 0
d = 0
e = []
for i in p:
#
@ -27,6 +28,7 @@ async def _(event):
view_messages=True
)
if i.deleted:
d = d + 1
try:
await borg(EditBannedRequest(event.chat_id, i, rights))
c = c + 1
@ -35,6 +37,6 @@ async def _(event):
break
except:
e.append("ERROR")
await event.edit("Kicked {} / {} users".format(c, len(p)))
await event.edit("Found {} Deleted Accounts. Kicked {} / {} users".format(d, c, len(p)))

View File

@ -0,0 +1,22 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from telethon import events
import os
import requests
import json
APP_ID = os.environ.get("OPEN_WEATHER_MAP_APPID")
@borg.on(events.NewMessage(pattern=r".weather (.*)", outgoing=True))
async def _(event):
if event.fwd_from:
return
sample_url = "https://api.openweathermap.org/data/2.5/weather?q={}&APPID={}"
input_str = event.pattern_match.group(1)
response_api = requests.get(sample_url.format(input_str, APP_ID)).json()
if response_api["cod"] == 200:
await event.edit(json.dumps(response_api["main"]))
else:
await event.edit(response_api["message"])

View File

@ -0,0 +1,30 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from telethon import events
import os
import requests
ACCESS_KEY = os.environ.get("SCREEN_SHOT_LAYER_ACCESS_KEY")
@borg.on(events.NewMessage(pattern=r".screencapture (.*)", outgoing=True))
async def _(event):
if event.fwd_from:
return
sample_url = "https://api.screenshotlayer.com/api/capture?access_key={}&url={}"
input_str = event.pattern_match.group(1)
response_api = requests.get(sample_url.format(ACCESS_KEY, input_str), stream=True)
if "invalid_access_key" not in response_api.text:
temp_file_name = "screenshotlayer.png"
with open(temp_file_name, "wb") as fd:
for chunk in response_api.iter_content(chunk_size=128):
fd.write(chunk)
try:
await borg.send_file(event.chat_id, temp_file_name, caption=input_str, force_document=False)
await event.delete()
except:
await event.edit(response_api.text)
os.remove(temp_file_name)
else:
await event.edit(response_api.text)

View File

@ -0,0 +1,22 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from telethon import events
import os
import requests
@borg.on(events.NewMessage(pattern=r".download", outgoing=True))
async def _(event):
if event.fwd_from:
return
current_date_time = "./DOWNLOADS/"
if not os.path.isdir(current_date_time):
os.makedirs(current_date_time)
if event.reply_to_msg_id:
message_id = event.reply_to_msg_id
required_message = await borg.get_messages(event.chat_id, limit=1, max_id=message_id+1, min_id=message_id-1)
downloaded_file_name = await borg.download_media(required_message, current_date_time)
await event.edit("Downloaded to {}.".format(downloaded_file_name))
else:
await event.edit("Reply to a message to download to my local server.")

View File

@ -17,6 +17,6 @@ async def _(event):
await event.edit('Text: **'+str+'**\n\nMeaning: **'+mean[0]['def']+'**\n\n'+'Example: \n__'+mean[0]['example']+'__')
else:
await event.edit("No result found for **"+str+"**")
except e:
except:
await event.edit("No result found for **"+str+"**")