Untitled
unknown
python
3 years ago
65 kB
11
Indexable
import sys
import random
from os import system
#from sidd import sid
import os
import threading
import time
#import txt2pdf
import random
import json
import base64
import requests
#from log import mainn
import random
#from acc import acc_m
from uuid import uuid4
from time import time as timestamp
from threading import Thread
from os import _exit,path
from aminofix.lib.util import exceptions
from ast import literal_eval
done = 'false'
import requests
#from yy import main
from io import BytesIO
import urllib.request
from io import BytesIO
from urllib.request import urlopen
from zipfile import ZipFile
from time import sleep
from threading import Thread
from json import dumps, load
import platform,socket,re,uuid
from random import choice, randint
from pathlib import Path
from contextlib import suppress
from datetime import datetime
#from pdf2image import convert_from_path
from BotAmino import BotAmino, Parameters
from hashlib import sha1
import names
import random
import hmac
import random,string,hashlib,base64,importlib,threading
#from amino import client
from aminofix.lib.util import exceptions, headers, device, objects
device = device.DeviceGenerator()
#headers.sid = client.Clien
# Big optimisation thanks to SempreLEGIT#1378 ♥
version = "1.9.0"
print(f"AminoBot version : {version}")
path_utilities = "utilities"
path_eljson1 = f"{path_utilities}/elJson.json"
path_eljson2 = f"{path_utilities}/elJson2.json"
path_download = "audio"
path_lock = f"{path_utilities}/locked"
Path(path_download).mkdir(exist_ok=True)
Path(path_lock).mkdir(exist_ok=True)
client = BotAmino()
#client.headers["NDCAUTH"] = f'sid={sid}'
#print(client.sid)
#client.no_command_message = f"This is not a command sorry!\nTry {client.prefix}help for help or send me a message"
#client.wait = 3
#client.spam_message = "Cooldown, please wait before doing a command again..."
bio ="𝘜 𝘴𝘰𝘶𝘯𝘥 𝘣𝘦𝘵𝘵𝘦𝘳 𝘸𝘪𝘵𝘩 𝘺𝘰𝘶𝘳 𝘮𝘰𝘶𝘵𝘩 𝘤𝘭𝘰𝘴𝘦𝘥"
client.prefix="*"
#client.self_callable=True
#client.show_online = True
nick='𝘑𝘶𝘭𝘪𝘴-𝘈𝘭𝘦𝘹𝘪𝘢'
def nope(data):
return data.authorId in (f"{client.userId}")
def print_exception(exc):
print(repr(exc))
def yo(data):
return data.chatId==("42cad00f-ef76-479d-b821-f6475fc95500")
def com(data):
return data.comId=="12719415"
def private(args):
return args.chatId=="c4fa059b-e344-45d1-836f-f436859fc247"
def verif(data):
return data.chatId=="1a5e5e9c-532b-4eb1-a54b-a8896d02c032"
def tapp(data):
return data.chatId=="e86b7a5f-15fd-4074-874c-80614d372f34"
def chatj(data):
return data.chatId=="6abce6e4-8b07-4408-b50e-40edd93d170e"
def is_staff(args):
return args.authorId in ('a22c8610-b5cb-44b0-9e2f-faf6b3d7bfef')
def join_community(comId: str = None, inv: str = None):
if inv:
try:
client.client.request_join_community(comId=comId, message='Cookie for everyone!!')
return True
except Exception as e:
print_exception(e)
else:
try:
client.client.join_community(comId=comId, invitationId=inv)
return True
except Exception as e:
print_exception(e)
def reset():
print("argv was",sys.argv)
print("sys.executable was", sys.executable)
print("restart now")
os.execv(sys.executable, ['python'] + sys.argv)
@client.command(condition=nope)
def com(data):
fok=client.get_from_code(data.message)
#id=fok.objectId
comid=fok.path[1:fok.path.index("/")]
client.join_community(comid)
data.subClient.send_message(data.chatId,"done")
reset()
@client.command(condition=nope)
def pay(data):
p=data.message
bb=client.get_from_code(str(p).split()[0])
idd=bb.objectId
comId=bb.path[1:bb.path.index("/")]
cId=int(comId)
client.join_community(comId)
sub=client.get_community(cId)
data.subClient.send_message(data.chatId,"start")
for _ in range(int(str(p).split()[1])):
sub.send_coins(blogId=idd,coins=500)
@client.command()
def live(data):
if __name__ == '__main__':
while True:
main(data.comId,data.chatId)
sleep(30)
@client.command(condition=nope)
def logout(data):
if __name__ == '__main__':
mainn()
def deviceid():
hw=(names.get_full_name()+str(random.randint(0,10000000))+platform.version()+platform.machine()+names.get_first_name()+socket.gethostbyname(socket.gethostname())+':'.join(re.findall('..', '%012x' % uuid.getnode()))+platform.processor())
identifier=sha1(hw.encode('utf-8')).digest()
mac = hmac.new(bytes.fromhex('76b4a156aaccade137b8b1e77b435a81971fbd3e'), b"\x32" + identifier, sha1)
return (f"32{identifier.hex()}{mac.hexdigest()}").upper()
@client.command()
def sid_ex(args):
file=open("sidd.txt","r+")
file.truncate(0)
file.close()
sid()
@client.command(condition=nope)
def dbug(args):
#args.subClient.delete_message(args.chatId, args.messageId, asStaff=False, reason="Clear")
args.subClient.send_message(args.chatId,message=args.message, embedLink="ndc://fragment/com.narvii.util.debug.DebugInfoFragment", embedTitle=args.message, embedContent="y")
@client.command(condition=nope)
def cbug(args):
args.subClient.delete_message(args.chatId, args.messageId, asStaff=False, reason="Clear")
args.subClient.send_message(args.chatId,message=args.message, embedLink="ndc://fragment/com.narvii.wallet.PurchaseCoinFragment", embedTitle=args.message)
@client.command(condition=nope)
def joinamino(args):
invit = None
if client.taille_commu >= 20:
args.subClient.send_message(args.chatId, "The bot has joined too many communities!")
return
staff = args.subClient.get_staff(args.message)
if args.authorId not in staff:
args.subClient.send_message(args.chatId, "You need to be in the community's staff!")
return
if not staff:
args.subClient.send_message(args.chatId, "Wrong amino ID!")
return
try:
test = args.message.strip().split()
amino_c = test[0]
invit = test[1]
invit = invit.replace("http://aminoapps.com/invite/", "")
except Exception:
amino_c = args.message
invit = None
try:
val = args.subClient.client.get_from_code(f"http://aminoapps.com/c/{amino_c}")
comId = val.json["extensions"]["community"]["ndcId"]
except Exception:
return
isJoined = val.json["extensions"]["isCurrentUserJoined"]
if not isJoined:
size = val.json['extensions']['community']['membersCount']
if size < 100:
args.subClient.send_message(args.chatId, "Your community must have at least 100 members")
return
join_community(comId, invit)
val = client.client.get_from_code(f"http://aminoapps.com/c/{amino_c}")
isJoined = val.json["extensions"]["isCurrentUserJoined"]
if isJoined:
client.add_community(args.message)
client[comId].run()
auth = client.get_community(comId).get_user_info(args.message).nickname
client.get_community(comId).ask_amino_staff(f"Hello! I am a bot and i can do a lot of stuff!\nI've been invited here by {auth}.\nIf you need help, you can do !help.\nEnjoy^^")
args.subClient.send_message(args.chatId, "Joined!")
return
args.subClient.send_message(args.chatId, "Waiting for join!")
return
else:
args.subClient.send_message(args.chatId, "Allready joined!")
return
args.subClient.send_message(args.chatId, "Something went wrong!")
@client.command(condition=nope)
def tr(args):
content = args.subClient.get_message_info(chatId = args.chatId, messageId = args.replyId).content
print(content)
translator = google_translator()
detect_result = translator.detect(content)[1]
translate_text = translator.translate(content)
print(translate_text)
reply = "[IC]"+str(translate_text)+"\n\n[c]Translated Text from "+str(detect_result)
print(reply)
args.subClient.send_message(chatId=args.chatId,message=reply,replyTo=args.messageId)
def remove(input):
try:
os.remove(f"{input}")
print("removed")
except Exception:
pass
@client.command(condition=nope)
def bg(data):
try:
os.remove("bg.png")
except:
pass
image = data.subClient.get_chat_thread(chatId=data.chatId).backgroundImage
if image:
print(image)
filename = "bg.png"
remove(filename)
urllib.request.urlretrieve(image, filename)
with open(filename, 'rb') as fp:
data.subClient.send_message(data.chatId, file=fp, fileType="image")
os.remove(filename)
@client.command(condition=nope)
def gif(args):
filename = "1.gif"
remove(filename)
req=requests.get(f"https://api.giphy.com/v1/gifs/search?q={args.message}&api_key=12ss5TcLvRjUze&offset=0&limit=25",headers={"Accept-Language": "en-US",
"User-Agent": "Dalvik/2.1.0 (Linux; U; Android 5.1; Google Build/vbox86p-userdebug; com.narvii.amino.master/3.4.33592)",
"Host": "api.giphy.com",
"Connection":"Keep-Alive",
"Accept-Encoding": "gzip"})
data=req.json()
urls=[]
f=data["data"]
for g in f:
p=g["images"]["fixed_height_downsampled"]["url"]
urls.append(p)
r=random.randint(1,20)
image=urls[r]
#print(image)
urllib.request.urlretrieve(image, filename)
with open(filename, 'rb') as fp:
args.subClient.send_message(chatId=args.chatId,file=fp,fileType="gif")
remove(filename)
@client.command(condition=nope)
def title(args):
if client.check(args, 'staff', id_=client.botId):
try:
title, color = args.message.split("color=")
color = color if color.startswith("#") else f'#{color}'
except Exception:
title = args.message
color = None
mention = args.subClient.get_message_info(chatId=args.chatId, messageId=args.messageId).mentionUserIds
if mention:
args.authorId = mention
args.author = args.subClient.get_user_info(args.authorId).nickname
if args.subClient.add_title(args.authorId, title, color):
args.subClient.send_message(args.chatId, f"The titles of {args.author} has changed")
@client.command(condition=nope)
def url(args):
print(args.authorId)
data = args.subClient.get_message_info(chatId = args.chatId, messageId = args.messageId)
reply_message = data.json['extensions']
if reply_message:
image = data.json['extensions']['replyMessage']['mediaValue']
args.subClient.send_message(args.chatId, message=image)
#@client.command(condition=nope)
def find(data,chatId):
while True:
p=data.subClient.get_chat_messages(chatId=chatId,size=1).content
#print(p)
for j in p:
g=j
#print(g)
l=f"{g}"
length=str(len(l))
if "6"==length:
break
return g
@client.command(condition=nope)
def acc(data):
acc_m()
h=open("acc.txt").read().splitlines()
r=random.randint(0,10)
send=h[r]
data.subClient.send_message(data.chatId,f"{send}")
@client.command(condition=nope)
def acchh(data):
try: os.remove("code.png")
except: pass
type=data.subClient.get_chat_thread(chatId=data.chatId).type
#print(
if type==0:
dev=deviceid()
#print(data.replySrc)
email=client.gen_email()
if data.message == "":
nickname="bott"
password="dick.py"
ff=f"using default\nnickname:{nickname}\npassword:{password}"
data.subClient.send_message(data.chatId,ff)
with TorRequests() as tor_requests:
with tor_requests.get_session() as sess:
client.request_verify_code(sess=sess,email = email,dev=dev)
link=client.get_message(email)
try: os.remove("code.png")
except: pass
wget.download(url=link,out="code.png")
with open("code.png","rb") as file:
data.subClient.send_message(chatId=data.chatId,fileType="image",file=file)
while True:
try: os.remove("code.png")
except: pass
g=find(data,data.chatId)
#print(g)
sec=client.register(sess=sess,email = email,password = password,nickname = nickname, verificationCode = g,deviceId=dev)
print(sec)
if sec["api:statuscode"]==3102:
data.subClient.send_message(data.chatId,"verification code is incorrect try again")
if sec["api:statuscode"]==0:
ac={}
secret=sec["secret"]
ac["email"]=str(email)
ac["password"]=str(password)
ac["device"]=str(dev)
dd=json.dumps(ac)
data.subClient.send_message(data.chatId,f"{dd}")
ac["secret"]=secret
t=json.dumps(ac)
with open ("accounts.json","a") as f:
f.write(f"{t},")
print("Saved in File accounts.json")
break
else:
data.subClient.send_message(data.chatId,f"{sec}")
break
else:
p=data.message
try: os.remove("code.png")
except: pass
nickname=str(p).split()[0]
password=str(p).split()[1]
with TorRequests() as tor_requests:
with tor_requests.get_session() as sess:
client.request_verify_code(sess=sess,email = email,dev=dev)
link=client.get_message(email)
wget.download(url=link,out="code.png")
with open("code.png","rb") as file:
data.subClient.send_message(chatId=data.chatId,fileType="image",file=file)
while True:
try: os.remove("code.png")
except: pass
g=find(data,data.chatId)
sec=client.register(sess=sess,email = email,password = password,nickname = nickname, verificationCode = g,deviceId=dev)
if sec["api:statuscode"]==3102:
data.subClient.send_message(data.chatId,"verification code is incorrect try again")
if sec["api:statuscode"]==0:
ac={}
secret=sec["secret"]
ac["email"]=str(email)
ac["password"]=str(password)
ac["device"]=str(dev)
dd=json.dumps(ac)
data.subClient.send_message(data.chatId,f"{dd}")
ac["secret"]=secret
t=json.dumps(ac)
with open ("accounts.json","a") as f:
f.write(f"{t},")
print("Saved in File accounts.json")
break
else:
data.subClient.send_message(data.chatId,f"{sec}")
break
else:
try: os.remove("code.png")
except: pass
data.subClient.send_message(data.chatId,"only for dm")
@client.command()
def cookie(args):
#print(args.chatId)
args.subClient.send_message(args.chatId, f"Here is a cookie for {args.author} 🍪")
@client.command(condition=nope)
def ramen(args):
args.subClient.send_message(args.chatId, f"Here are some ramen for {args.author} 🍜")
@client.command(condition=nope)
def dice(args):
if not args.message:
args.subClient.send_message(args.chatId, f"🎲 -{randint(1, 20)},(1-20)- 🎲", replyTo=args.messageId)
return
try:
n1, n2 = map(int, args.message.split('d'))
times = n1 if n1 < 20 else 20
max_num = n2 if n2 < 1_000_000 else 1_000_000
numbers = [randint(1, (max_num)) for _ in range(times)]
args.subClient.send_message(args.chatId, f'🎲 -{sum(numbers)},[ {" ".join(map(str, numbers))}](1-{max_num})- 🎲')
except Exception as e:
print_exception(e)
@client.command(condition=nope)
def join(args):
val = args.subClient.join_chatroom(args.message, args.chatId)
if val or val == "":
args.subClient.send_message(args.chatId, f"Chat {val} joined".strip())
else:
args.subClient.send_message(args.chatId, "No chat joined")
@client.command(condition=nope)
def joinall(args):
args.subClient.join_all_chat()
args.subClient.send_message(args.chatId, "All chat joined")
@client.command(condition=is_staff)
def leaveall(args):
args.subClient.send_message(args.chatId, "Leaving all chat...")
args.subClient.leave_all_chats()
@client.command(condition=nope)
def leave(args):
if args.message:
chat_ide = args.subClient.get_chat_id(args.message)
if chat_ide:
args.chatId = chat_ide
args.subClient.leave_chat(args.chatId)
def extra(uid : str):
event=uuid4()
data = {
"reward":{"ad_unit_id":"255884441431980_807351306285288","credentials_type":"publisher","custom_json":{"hashed_user_id":f"{uid}"},"demand_type":"sdk_bidding","event_id":f"{event}","network":"facebook","placement_tag":"default","reward_name":"Amino Coin","reward_valid":"true","reward_value":2,"shared_id":"dc042f0c-0c80-4dfd-9fde-87a5979d0d2f","version_id":"1569147951493","waterfall_id":"dc042f0c-0c80-4dfd-9fde-87a5979d0d2f"},
"app":{"bundle_id":"com.narvii.amino.master","current_orientation":"portrait","release_version":"3.4.33567","user_agent":"Dalvik\/2.1.0 (Linux; U; Android 10; G8231 Build\/41.2.A.0.219; com.narvii.amino.master\/3.4.33567)"},"date_created":1620295485,"session_id":"49374c2c-1aa3-4094-b603-1cf2720dca67","device_user":{"country":"US","device":{"architecture":"aarch64","carrier":{"country_code":602,"name":"Vodafone","network_code":0},"is_phone":"true","model":"GT-S5360","model_type":"Samsung","operating_system":"android","operating_system_version":"29","screen_size":{"height":2260,"resolution":2.55,"width":1080}},"do_not_track":"false","idfa":"7495ec00-0490-4d53-8b9a-b5cc31ba885b","ip_address":"","locale":"en","timezone":{"location":"Asia\/Seoul","offset":"GMT+09:00"},"volume_enabled":"true"}
}
headers={
"cookies":"__cfduid=d0c98f07df2594b5f4aad802942cae1f01619569096",
"authorization":"Basic NWJiNTM0OWUxYzlkNDQwMDA2NzUwNjgwOmM0ZDJmYmIxLTVlYjItNDM5MC05MDk3LTkxZjlmMjQ5NDI4OA=="
}
requests.post("https://ads.tapdaq.com/v4/analytics/reward",json=data, headers=headers)
@client.command(condition=is_staff)
def clear(args):
if client.check(args, 'staff', client.botId):
try:
size = int(args.message)
except Exception:
size = 1
args.subClient.delete_message(args.chatId, args.messageId, asStaff=True, reason="Clear")
if size > 99:
size = 99
messages = args.subClient.get_chat_messages(chatId=args.chatId, size=size).messageId
for message in messages:
args.subClient.delete_message(args.chatId, messageId=message, asStaff=True, reason="Clear")
@client.command(condition=nope)
def video_chat(args):
client.start_vc(chatId=args.chatId,comId=args.comId)
@client.command(condition=nope)
def end(data):
client.end_vc(chatId=data.chatId,comId=data.comId)
#client.command(condition=coin)
def tap(args):
args.subClient.send_message(args.chatId,"start")
for _ in range(250):
Thread(target=extra,args=(args.authorId,)).start()
#args.subClient.send_message(args.chatId,"finished")
@client.command(condition=nope)
def spam(args):
quantity, msg = args.message.split()
quantity = 1 if not quantity.isdigit() else int(quantity)
quantity = 10 if quantity > 10 else quantity
for _ in range(quantity):
args.subClient.send_message(args.chatId, msg)
@client.command(condition=nope)
def mention(args):
val = args.subClient.get_user_id(args.message)
if not val:
args.subClient.send_message(chatId=args.chatId, message="Username not found")
return
with suppress(Exception):
args.subClient.send_message(chatId=args.chatId, message=f"@{val[0]}", mentionUserIds=[val[1]])
@client.command("all",condition=nope)
def everyone(args):
mention = [userId for userId in args.subClient.get_chat_users(chatId=args.chatId).userId]
# test = "".join(["" for user in args.subClient.get_chat_users(chatId=args.chatId).userId])
args.subClient.send_message(chatId=args.chatId, message=f"@everyone {args.message}", mentionUserIds=mention)
@client.command(condition=nope)
def viewmode(data):
id = data.subClient.get_chat_threads(start=0, size=40).chatId
for chat in id:
with suppress(Exception):
data.subClient.edit_chat(chatId=chat, viewOnly=True)
@client.command(condition=private)
def vdisable(data):
if data.message == "":
data.subClient.edit_chat(chatId="8528067a-5c84-4da1-8444-ca4b79fa9cab", viewOnly=False)
data.subClient.send_message(chatId=data.chatId, message="done")
else:
id =client.get_from_code(data.message).objectId
data.subClient.edit_chat(chatId=id, viewOnly=False)
data.subClient.send_message(chatId=data.chatId, message="done")
@client.command(condition=private)
def vmode(data):
if data.message == "":
data.subClient.edit_chat(chatId="8528067a-5c84-4da1-8444-ca4b79fa9cab", viewOnly=True)
data.subClient.send_message(chatId=data.chatId, message="done")
else:
id =client.get_from_code(data.message).objectId
data.subClient.edit_chat(chatId=id, viewOnly=True)
data.subClient.send_message(chatId=data.chatId, message="done")
def Tass(data):
listusers=[]
for userId ,status in zip(data.profile.userId,data.profile.status):
if status!=9 and status !=10:
listusers.append(userId)
return listusers
@client.command(condition=nope)
def img(data):
url=getImageDirectory(data.message)
urllib.request.urlretrieve(url,f"{data.message}.png")
with open(f"{data.message}.png", 'rb') as file:
try:
data.subClient.send_message(chatId =data.chatId, file = file, fileType = "image")
os.remove(f"{data.message}.png")
except:
pass
@client.command(condition=nope)
def msg(args):
value = 0
size = 1
ment = None
with suppress(Exception):
args.subClient.delete_message(args.chatId, args.messageId, asStaff=False, reason="Clear")
if "chat=" in args.message:
chat_name = args.message.rsplit("chat=", 1).pop()
chat_ide = args.subClient.get_chat_id(chat_name)
if chat_ide:
args.chatId = chat_ide
args.message = " ".join(args.message.strip().split()[:-1])
try:
size = int(args.message.split().pop())
args.message = " ".join(args.message.strip().split()[:-1])
except ValueError:
size = 0
try:
value = int(args.message.split().pop())
args.message = " ".join(args.message.strip().split()[:-1])
except ValueError:
value = size
size = 1
if not args.message and value == 1:
args.message = f"@{args.author}"
ment = args.authorId
if size > 10:
size = 10
for _ in range(size):
with suppress(Exception):
args.subClient.send_message(chatId=args.chatId, message=f"{args.message}", messageType=value, mentionUserIds=ment)
# add banned words
@client.command(condition=is_staff)
def abw(args):
if not args.message or args.message in args.subClient.banned_words:
return
try:
args.message = args.message.lower().strip().split()
except Exception:
args.message = [args.message.lower().strip()]
args.subClient.add_banned_words(args.message)
args.subClient.send_message(args.chatId, "Banned word list updated")
# remove banned words
@client.command(condition=is_staff)
def rbw(args):
if not args.message:
return
try:
args.message = args.message.lower().strip().split()
except Exception:
args.message = [args.message.lower().strip()]
args.subClient.remove_banned_words(args.message)
args.subClient.send_message(args.chatId, "Banned word list updated")
@client.command("bwl", condition=nope)
def banned_word_list(args):
val = ""
if args.subClient.banned_words:
for elem in args.subClient.banned_words:
val += elem + "\n"
if len(val) >= 1950:
args.subClient.send_message(args.chatId, val)
val = ""
else:
val = "No words in the list"
args.subClient.send_message(args.chatId, val)
@client.command(condition=is_staff)
def sw(args):
args.subClient.set_welcome_message(args.message)
args.subClient.send_message(args.chatId, "Welcome message changed")
@client.command("chatlist", condition=is_staff)
def get_chats(args):
val = args.subClient.get_chats()
for title, _ in zip(val.title, val.chatId):
args.subClient.send_message(args.chatId, title)
@client.command("chatid", condition=nope)
def chat_id(args):
val = args.subClient.get_chats()
for title, chat_id in zip(val.title, val.chatId):
if args.message.lower() in title.lower():
args.subClient.send_message(args.chatId, f"{title} | {chat_id}")
@client.command("leaveamino", condition=nope)
def leaveamino(args):
args.subClient.send_message(args.chatId, "Leaving the amino!")
args.subClient.leave_community()
@client.command(condition=nope)
def p(args):
with suppress(Exception):
args.subClient.delete_message(args.chatId, args.messageId, asStaff=False)
transactionId = "b8ad47da-2103-4c5f-976a-f16989da31ef"
if args.message:
chat_ide = args.subClient.get_chat_id(args.message)
if chat_ide:
args.chatId = chat_ide
for _ in range(5):
args.subClient.pay(coins=args.message, chatId=args.chatId, transactionId=transactionId)
@client.command(condition=nope)
def c(args):
with suppress(Exception):
args.subClient.delete_message(args.chatId, args.messageId, asStaff=False, reason="Clear")
for _ in range(10):
args.subClient.send_coins(chatId=args.chatId,coins=args.message)
def telecharger(url):
music = None
if ("=" in url and "/" in url and " " not in url) or ("/" in url and " " not in url):
if "=" in url and "/" in url:
music = url.rsplit("=", 1)[-1]
elif "/" in url:
music = url.rsplit("/")[-1]
if music in os.listdir(path_download):
return music
ydl_opts = {
'format': 'bestaudio/best',
'postprocessors': [{
'key': 'FFmpegExtractAudio',
'preferredcodec': 'mp3',
'preferredquality': '192',
}],
'extract-audio': True,
'outtmpl': f"{path_download}/{music}.webm",
}
with YoutubeDL(ydl_opts) as ydl:
video_length = ydl.extract_info(url, download=True).get('duration')
ydl.cache.remove()
url = music+".mp3"
return url, video_length
return False, False
@client.command(condition=nope)
def joinn(args):
p=client.get_from_code(args.message).objectId
args.subClient.join_chat(p)
def decoupe(musical, temps):
size = 170
with open(musical, "rb") as fichier:
nombre_ligne = len(fichier.readlines())
if temps < 180 or temps > 540:
return False
decoupage = int(size*nombre_ligne / temps)
t = 0
file_list = []
for a in range(0, nombre_ligne, decoupage):
b = a + decoupage
if b >= nombre_ligne:
b = nombre_ligne
with open(musical, "rb") as fichier:
lignes = fichier.readlines()[a:b]
with open(musical.replace(".mp3", "PART"+str(t)+".mp3"), "wb") as mus:
for ligne in lignes:
mus.write(ligne)
file_list.append(musical.replace(".mp3", "PART"+str(t)+".mp3"))
t += 1
return file_list
@client.command('🌚', condition=nope)
def refid(args):
with suppress(Exception):
args.subClient.delete_message(args.chatId, args.messageId, asStaff=False, reason="Clear")
sleep(3)
args.subClient.refid(chatId=args.chatId,message='6:40 pm', messageType=109)
@client.command(condition=nope)
def kik(args):
list = []
chatMembers = args.subClient.get_chat_users(chatId=args.chatId,start=0,size=100).nickname
for i in range(int(args.message)):
member = random.choice(chatMembers)
args.subClient.send_message(args.chatId,message=f"{member} has left the conversation.", messageType=109)
list.append(member)
@client.command(condition=nope)
def convert(data):
video = pafy.new(data.message)
best = video.getbest()
playurl = best.url
urllib.request.urlretrieve(playurl,"yo.mp3")
with open("yo.mp3", 'rb') as file:
try:
data.subClient.send_message(chatId=data.chatId,file=file,fileType="audio")
os.remove("yo.mp3")
except Exception as e:
print(e)
pass
@client.command(condition=nope)
def play(args):
music, size = telecharger(args.message)
if music:
music = f"{path_download}/{music}"
val = decoupe(music, size)
if not val:
try:
with open(music, 'rb') as fp:
args.subClient.send_message(args.chatId, file=fp, fileType="audio")
except Exception:
args.subClient.send_message(args.chatId, "Error! File too heavy (9 min max)")
os.remove(music)
return
os.remove(music)
for elem in val:
with suppress(Exception):
with open(elem, 'rb') as fp:
args.subClient.send_message(args.chatId, file=fp, fileType="audio")
os.remove(elem)
return
args.subClient.send_message(args.chatId, "Error! Wrong link")
@client.command("help",condition=nope)
def helper(args):
if not args.message:
args.subClient.send_message(args.chatId, helpMsg1)
elif args.message == "msg":
args.subClient.send_message(args.chatId, help_message)
elif args.message == "ask":
args.subClient.send_message(args.chatId, helpAsk)
else:
args.subClient.send_message(args.chatId, "No help is available for this command")
import os
import sys
@client.command()
def restart(data):
data.subClient.send_message(data.chatId,"done")
sys.argv
sys.executable
print("restart now")
os.execv(sys.executable, ['python'] + sys.argv)
@client.command(condition=nope)
def stop(args):
args.subClient.send_message(args.chatId, "Stopping Bot")
os.execv(sys.executable, ["None", "None"])
@client.command(condition=nope)
def uinfo(args):
val = ""
val2 = ""
uid = ""
with suppress(Exception):
val = args.subClient.client.get_user_info(args.message)
val2 = args.subClient.get_user_info(args.message)
if not val:
uid = args.subClient.get_user_id(args.message)
if uid:
val = args.subClient.client.get_user_info(uid[1])
val2 = args.subClient.get_user_info(uid[1])
if not val:
with suppress(Exception):
lin = args.subClient.client.get_from_code(f"http://aminoapps.com/u/{args.message}").json["extensions"]["linkInfo"]["objectId"]
val = args.subClient.client.get_user_info(lin)
with suppress(Exception):
val2 = args.subClient.get_user_info(lin)
with suppress(Exception):
with open(path_eljson1, "w") as file:
file.write(dumps(val.json, sort_keys=True, indent=4))
with suppress(Exception):
with open(path_eljson2, "w") as file:
file.write(dumps(val2.json, sort_keys=True, indent=4))
for i in (path_eljson1, path_eljson2):
if os.path.getsize(i):
txt2pdf.callPDF(i, "result.pdf")
pages = convert_from_path('result.pdf', 150)
file = 'result.jpg'
for page in pages:
page.save(file, 'JPEG')
with open(file, 'rb') as fp:
args.subClient.send_message(args.chatId, file=fp, fileType="image")
os.remove(file)
os.remove("result.pdf")
if not os.path.getsize(path_eljson1) and not os.path.getsize(path_eljson1):
args.subClient.send_message(args.chatId, "Error!")
def bubble_info(bubbleId:str,comId):
api=f"https://service.narvii.com/api/v1/x{comId}/s/chat/chat-bubble/{bubbleId}"
res=requests.get(api,headers=client.headers)
url=json.loads(res.text)['chatBubble']['resourceUrl']
#print(url)
if res.status_code !=200:
return json.loads(res.text)
else: return url
def upload_bubble(file,comId):
data=file
response = requests.post(f"https://service.narvii.com/api/v1/x{comId}/s/chat/chat-bubble/templates/107147e9-05c5-405f-8553-af65d2823457/generate", data=data, headers=client.headers)
bid=json.loads(response.text)['chatBubble']['bubbleId']
print(bid)
response = requests.post(f"https://service.narvii.com/api/v1/x{comId}/s/chat/chat-bubble/{bid}", data=data, headers=client.headers)
if response.status_code !=200:
return json.loads(response.text)
else: return bid
@client.command(condition=nope)
def copybubble(args):
a=args.subClient.get_message_info(args.chatId,args.replyId).json["chatBubble"]["resourceUrl"]
with urlopen(a) as zipresp:
yo=zipresp.read()
f=upload_bubble(file=k,comId=args.comId)
print("uploaded")
args.subClient.apply_bubble(chatId=args.chatId,bubbleId=f,applyToAll=True)
args.subClient.send_message(chatId=args.chatId,message='done')
def upload(url):
link = requests.get(url)
result = BytesIO(link.content)
return result
@client.command(condition=nope)
def profile(data):
e=data.subClient.edit_profile
m=data.subClient.get_message_info(data.chatId,data.replyId)
id=m.json['uid']
k=data.subClient.get_user_info(id)
try:
bg=k.json["extensions"]["style"]["backgroundMediaList"]
for bgg in bg:
for i in bgg:
if i != None and i != 100 and len(i):
#print(i)
e(backgroundImage=i)
except:
pass
try:
for mediaList in k.mediaList:
for L in mediaList:
if L != None and L != 100 and len(L):
e(imageList=[upload(L)])
except:
pass
e(nickname=k.nickname)
e(content=k.content)
e(backgroundImage=k.backgroundImage)
e(icon=upload(k.icon))
e(backgroundColor=k.backgroundColor)
print(k.avatarFrameId)
try:
data.subClient.apply_avatar_frame(avatarId=k.avatarFrameId)
except:
pass
print("done")
@client.command(condition=nope)
def copyall(data):
u=data.subClient.get_message_info(data.chatId,data.replyId).json["chatBubble"]["resourceUrl"]
yo=urlopen(u).read()
a=data.subClient.get_message_info(data.chatId,data.replyId).json["chatBubble"]["bubbleId"]
try:
data.subClient.apply_bubble(chatId=data.chatId,bubbleId=a,applyToAll=False)
except:
f=upload_bubble(file=yo,comId=data.comId)
data.subClient.apply_bubble(chatId=data.chatId,bubbleId=f,applyToAll=False)
pass
print(f)
for _ in range(2):
cc(data)
data.subClient.send_message(chatId=data.chatId,message="done")
@client.command(condition=nope)
def restore(data):
data.subClient.edit_profile(nickname=f"bᥲkᥙg᥆:3",icon=upload('http://mm1.narvii.com/8156/de2b0d7f8c9cfecbb0108097a071f1aad9a094b32276bb76r7-736-736_00.jpg'),imageList=[upload ('http://mm1.narvii.com/8156/9b3bf94901f5f93b539b3bf99b3bf96f3bf994d51ca6bd24r7-735-788_00.jpg')],content=f"into 🍉", backgroundColor=f"#000000")
try:
data.subClient.apply_avatar_frame(avatarId='ee5cded3-9679-4f42-8e21-f8608fa694aa')
except:
pass
try:
data.subClient.apply_bubble(chatId=data.chatId,bubbleId='6375fd04-2e7d-4f94-b59f-d0a30d9ed643',applyToAll=False)
except:
pass
@client.command(condition=nope)
def cinfo(args):
val = ""
with suppress(Exception):
val = args.subClient.client.get_from_code(f"http://aminoapps.com/c/{args.message}")
with suppress(Exception):
with open(path_eljson1, "w") as file:
file.write(dumps(val.json, sort_keys=True, indent=4))
if os.path.getsize(path_eljson1):
txt2pdf.callPDF(path_eljson1, "result.pdf")
pages = convert_from_path('result.pdf', 150)
for page in pages:
file = 'result.jpg'
page.save(file, 'JPEG')
with open(file, 'rb') as fp:
args.subClient.send_message(args.chatId, file=fp, fileType="image")
os.remove(file)
os.remove("result.pdf")
if not os.path.getsize(path_eljson1):
args.subClient.send_message(args.chatId, "Error!")
@client.command(condition=nope)
def sendinfo(args):
if args.message != "":
arguments = args.message.strip().split()
for eljson in (path_eljson1, path_eljson2):
if Path(eljson).exists():
arg = arguments.copy()
with open(eljson, 'r') as file:
val = load(file)
try:
memoire = val[arg.pop(0)]
except Exception:
args.subClient.send_message(args.chatId, 'Wrong key!')
if arg:
for elem in arg:
try:
memoire = memoire[str(elem)]
except Exception:
args.subClient.send_message(args.chatId, 'Wrong key!')
args.subClient.send_message(args.chatId, memoire)
@client.command(condition=is_staff)
def cohost(data):
mention = data.subClient.get_message_info(chatId=data.chatId, messageId=data.messageId).mentionUserIds
data.subClient.edit_chat(data.chatId, coHosts=mention)
@client.command("global",condition=nope)
def globall(data):
mention = data.subClient.get_message_info(chatId=data.chatId, messageId=data.messageId).mentionUserIds
for user in mention:
AID = client.get_user_info(userId=str(user)).aminoId
data.subClient.send_message(data.chatId, message="https://aminoapps.com/u/"+str(AID))
@client.command("global2")
def get_global(args):
val = args.subClient.get_user_id(args.message)[1]
if val:
ide = args.subClient.client.get_user_info(val).aminoId
args.subClient.send_message(args.chatId, f"http://aminoapps.com/u/{ide}")
else:
args.subClient.send_message(args.chatId, "Error!")
@client.command(condition=nope)
def follow(args):
args.subClient.follow_user(args.authorId)
args.subClient.send_message(args.chatId, "Now following you!")
@client.command(condition=nope)
def unfollow(args):
args.subClient.unfollow_user(args.authorId)
args.subClient.send_message(args.chatId, "Unfollow!")
@client.command(condition=nope)
def stopamino(args):
args.subClient.stop_instance()
del client[args.subClient.community_id]
@client.command(condition=nope)
def block(args):
val = args.subClient.get_user_id(args.message)
if val:
args.subClient.client.block(val[1])
args.subClient.send_message(args.chatId, f"User {val[0]} blocked!")
@client.command(condition=nope)
def unblock(args):
val = args.subClient.client.get_blocked_users()
for aminoId, userId in zip(val.aminoId, val.userId):
if args.message in aminoId:
args.subClient.client.unblock(userId)
args.subClient.send_message(args.chatId, f"User {aminoId} unblocked!")
@client.command(condition=is_staff)
def accept(args):
if args.subClient.accept_role(args.chatId):
args.subClient.send_message(args.chatId, "Accepted!")
return
val = args.subClient.get_notices(start=0, size=25)
for elem in val:
print(elem["title"])
res = None
for elem in val:
if 'become' in elem['title'] or "host" in elem['title']:
res = elem['noticeId']
if res and args.subClient.accept_role(res):
args.subClient.send_message(args.chatId, "Accepted!")
return
else:
args.subClient.send_message(args.chatId, "Error!")
@client.command(condition=nope)
def say(args):
audio_file = f"{path_download}/ttp{randint(1,500)}.mp3"
langue = list(lang.tts_langs().keys())
if not args.message:
args.message = args.subClient.get_chat_messages(chatId=args.chatId, size=2).content[1]
gTTS(text=args.message, lang="hi", slow=False).save(audio_file)
try:
with open(audio_file, 'rb') as fp:
args.subClient.send_message(args.chatId, file=fp, fileType="audio")
except Exception:
args.subClient.send_message(args.chatId, "Too heavy!")
os.remove(audio_file)
@client.command(condition=nope)
def ask(args):
lvl = ""
boolean = 1
if "lvl=" in args.message:
lvl = args.message.rsplit("lvl=", 1)[1].strip().split(" ", 1)[0]
args.message = args.message.replace("lvl="+lvl, "").strip()
elif "lvl<" in args.message:
lvl = args.message.rsplit("lvl<", 1)[1].strip().split(" ", 1)[0]
args.message = args.message.replace("lvl<"+lvl, "").strip()
boolean = 2
elif "lvl>" in args.message:
lvl = args.message.rsplit("lvl>", 1)[1].strip().split(" ", 1)[0]
args.message = args.message.replace("lvl>"+lvl, "").strip()
boolean = 3
try:
lvl = int(lvl)
except ValueError:
lvl = 20
args.subClient.ask_all_members(args.message+f"\n[CUI]This message was sent by {args.author}\n[CUI]I am a bot and have a nice day^^", lvl, boolean)
args.subClient.send_message(args.chatId, "Asking...")
@client.command(condition=nope)
def askstaff(args):
args.subClient.send_message(args.chatId, "Asking...")
amino_list = client.client.sub_clients()
for commu in amino_list.comId:
client.get_community(commu).ask_amino_staff(message=args.message)
args.subClient.send_message(args.chatId, "Asked")
@client.command("lockall",condition=nope)
def lock_all(args):
c=client.commands_list()
for command in c:
list = command.lower().strip().split()
#list = [command.lower().strip()]
#print(list)
args.subClient.add_locked_command(list)
args.subClient.send_message(args.chatId, "Locked command list updated")
@client.command(condition=is_staff)
def prefix(args):
if args.message:
args.subClient.set_prefix(args.message)
args.subClient.send_message(args.chatId, f"prefix set as {args.message}")
@client.command("lock", nope)
def lock_command(args):
if not args.message or args.message in args.subClient.locked_command or args.message not in client.get_commands_names() or args.message in ("lock", "unlock"):
return
try:
args.message = args.message.lower().strip().split()
except Exception:
args.message = [args.message.lower().strip()]
args.subClient.add_locked_command(args.message)
args.subClient.send_message(args.chatId, "Locked command list updated")
@client.command("unlock", nope)
def unlock_command(args):
if args.message:
try:
args.message = args.message.lower().strip().split()
except Exception:
args.message = [args.message.lower().strip()]
args.subClient.remove_locked_command(args.message)
args.subClient.send_message(args.chatId, "Locked command list updated")
@client.command("llock", nope)
def locked_command_list(args):
val = ""
if args.subClient.locked_command:
for elem in args.subClient.locked_command:
val += elem+"\n"
else:
val = "No locked command"
args.subClient.send_message(args.chatId, val)
@client.command("alock", nope)
def admin_lock_command(args):
if not args.message or args.message not in client.get_commands_names() or args.message == "alock":
return
command = args.subClient.admin_locked_command
args.message = [args.message]
if args.message[0] in command:
args.subClient.remove_admin_locked_command(args.message)
else:
args.subClient.add_admin_locked_command(args.message)
args.subClient.send_message(args.chatId, "Locked command list updated")
@client.command("allock", nope)
def locked_admin_command_list(args):
val = ""
if args.subClient.admin_locked_command:
for elem in args.subClient.admin_locked_command:
val += elem+"\n"
else:
val = "No locked command"
args.subClient.send_message(args.chatId, val)
@client.command("keepu", condition=is_staff)
def keep_favorite_users(args):
if client.check(args, "staff", id_=client.botId):
users = args.subClient.favorite_users
try:
val = args.subClient.get_user_id(args.message)
user, userId = val[0], val[1]
except Exception:
args.subClient.send_message(args.chatId, "Error, user not found!")
return
if userId not in users:
args.subClient.add_favorite_users(userId)
args.subClient.send_message(args.chatId, f"Added {user} to favorite users")
with suppress(Exception):
args.subClient.favorite(time=1, userId=userId)
return
elif not client.check(args, 'staff', id_=client.botId):
args.subClient.send_message(args.chatId, "The bot need to be in the staff!")
else:
args.subClient.send_message(args.chatId, "Error!")
@client.command("unkeepu", condition=is_staff)
def unkeep_favorite_users(args):
if client.check(args, "staff", id_=client.botId):
users = args.subClient.favorite_users
try:
val = args.subClient.get_user_id(args.message)
user, userId = val[0], val[1]
except Exception:
args.subClient.send_message(args.chatId, "Error, user not found!")
return
if userId in users:
args.subClient.remove_favorite_users(userId)
args.subClient.send_message(args.chatId, f"Removed {user} to favorite users")
with suppress(Exception):
args.subClient.unfavorite(userId=userId)
return
elif not client.check(args, 'staff', id_=client.botId):
args.subClient.send_message(args.chatId, "The bot need to be in the staff!")
else:
args.subClient.send_message(args.chatId, "Error!")
@client.command(condition=verif)
def verify(data):
u=data.subClient.get_user_info(data.authorId).customTitles
print(u)
if u is None:
u=[{"title":""}]
#print(u)
if [obj for obj in u if obj['title'] != 'verified']:
#subClient.kick(chatId=data.chatId,userId=data.authorId,allowRejoin=True)
title="verified"
color=f"#000000"
data.subClient.add_title(data.authorId, title, color)
data.subClient.send_message(data.chatId,f"verified {data.author}")
#break
else:
data.subClient.send_message(data.chatId,f"Already verified {data.author}")
@client.command(".")
def invite(args):
with suppress(Exception):
args.subClient.invite_to_vc(chatId=args.chatId,userId=args.authorId)
@client.command("keepc", condition=is_staff)
def keep_favorite_chats(args):
if client.check(args, 'staff', id_=client.botId):
chats = args.subClient.favorite_chats
with suppress(Exception):
chat = args.subClient.get_from_code(f"{args.message}")
if chat.objectId not in chats:
args.subClient.add_favorite_chats(chat.objectId)
args.subClient.send_message(args.chatId, "Added to favorite chats")
return
val = args.subClient.get_chats()
for title, chatId in zip(val.title, val.chatId):
if args.message == title and chatId not in chats:
args.subClient.add_favorite_chats(chatId)
args.subClient.send_message(args.chatId, f"Added {title} to favorite chats")
with suppress(Exception):
args.subClient.favorite(time=1, chatId=args.chatId)
return
for title, chatId in zip(val.title, val.chatId):
if args.message.lower() in title.lower() and chatId not in chats:
args.subClient.add_favorite_chats(chatId)
args.subClient.send_message(args.chatId, f"Added {title} to favorite chats")
with suppress(Exception):
args.subClient.favorite(time=1, chatId=chatId)
return
elif not client.check(args, 'staff', id_=client.botId):
args.subClient.send_message(args.chatId, "The bot need to be in the staff!")
else:
args.subClient.send_message(args.chatId, "Error!")
@client.command("unkeepc", condition=is_staff)
def unkeep_favorite_chats(args):
if args.subClient.is_in_staff(client.botId):
chats = args.subClient.favorite_chats
with suppress(Exception):
chat = args.subClient.get_from_code(f"{args.message}")
if chat.objectId in chats:
args.subClient.remove_favorite_chats(chat.objectId)
args.subClient.send_message(args.chatId, "Removed to favorite chats")
return
val = args.subClient.get_chats()
for title, chatid in zip(val.title, val.chatId):
if args.message == title and chatid in chats:
args.subClient.remove_favorite_chats(chatid)
args.subClient.unfavorite(chatId=chatid)
args.subClient.send_message(args.chatId, f"Removed {title} to favorite chats")
return
for title, chatid in zip(val.title, val.chatId):
if args.message.lower() in title.lower() and chatid in chats:
args.subClient.remove_favorite_chats(chatid)
args.subClient.unfavorite(chatId=chatid)
args.subClient.send_message(args.chatId, f"Removed {title} to favorite chats")
return
elif not client.check(args, 'staff', id_=client.botId):
args.subClient.send_message(args.chatId, "The bot need to be in the staff!")
else:
args.subClient.send_message(args.chatId, "Error!")
@client.command("welcome", condition=is_staff)
def welcome_channel(args):
args.subClient.set_welcome_chat(args.chatId)
args.subClient.send_message(args.chatId, "Welcome channel set!")
@client.command("unwelcome", condition=is_staff)
def unwelcome_channel(args):
args.subClient.unset_welcome_chat()
args.subClient.send_message(args.chatId, "Welcome channel unset!")
@client.command(condition=nope)
def level(args):
try:
args.message = int(args.message)
except Exception:
args.subClient.send_message(args.chatId, "Error, wrong level")
return
if args.message > 20:
args.message = 20
if args.message < 0:
args.message = 0
args.subClient.set_level(args.message)
args.subClient.send_message(args.chatId, f"Level set to {args.message}!")
@client.command(condition=nope)
def taxe(args):
coins = args.subClient.get_wallet_amount()
if coins >= 1:
amt = 0
while coins > 500:
args.subClient.pay(500, chatId=args.chatId)
coins -= 500
amt += 500
args.subClient.pay(int(coins), chatId=args.chatId)
args.subClient.send_message(args.chatId, f"Sending {coins+amt} coins...")
else:
args.subClient.send_message(args.chatId, "Account is empty!")
@client.command(condition=nope)
def id(data):
if data.message=="":
data.subClient.send_message(chatId=data.chatId,message=f"{data.comId}")
data.subClient.send_message(chatId=data.chatId,message=data.chatId)
else:
bb=client.get_from_code(data.message)
cid=bb.path[1:bb.path.index("/")]
data.subClient.send_message(chatId=data.chatId,message=f"{cid}")
try:
chatId=bb.objectId
data.subClient.send_message(chatId=data.chatId,message=f"{chatId}")
except:
pass
@client.command(condition=nope)
def test(data):
print(data.info.message.author.icon, data.info.message.author.icon)
data.subClient.send_message(data.chatId, message="Hello!^^", embedTitle=f"{data.author} is here!", embedImage=None)
helpMsg1 = """
[[ᴄʙ]-- ᴄᴏᴍᴍᴏɴ ᴄᴏᴍᴍᴀɴᴅ --
★ ʜᴇʟᴘ (ᴄᴏᴍᴍᴀɴᴅ)
★ ᴛɪᴛʟᴇ (ᴛɪᴛʟᴇ) =͟͟͞͞➳❥
★ ᴅɪᴄᴇ (xᴅʏ) =͟͟͞͞➳❥
★ ᴊᴏɪɴ (ᴄʜᴀᴛ).
★ᴍᴇɴᴛɪᴏɴ(ᴜsᴇʀ)
★ sᴘᴀᴍ (ᴀᴍᴏᴜɴᴛ)
★ᴍsɢ(ᴛʏᴘᴇ). =͟͟͞͞➳❥ ★ʙᴡʟ
★ ʟʟᴏᴄᴋ =͟͟͞͞➳❥. ★ ᴄʜᴀᴛʟɪsᴛ.
★ ɢʟᴏʙᴀʟ (ʟɪɴᴋ) ★ ʟᴇᴀᴠᴇ
★ ғᴏʟʟᴏᴡ =͟͟͞͞➳❥ . ★ᴜɴғᴏʟʟᴏᴡ ★ ᴄᴏɴᴠᴇʀᴛ (ᴜʀʟ) ★ᴘᴠᴘ. ★sʜɪᴘ.➳❥. ★ᴘʀᴀɴᴋ(ᴀᴍᴏᴜɴᴛ)
★ sʀᴄ (sᴇᴀʀᴄʜ) ➳❥. ★ɪᴍᴀɢᴇ. ★ sᴀʏ. =͟͟͞͞➳❥ ★ ɢɪғ.
★ ɢɪᴠᴇ =͟͟͞͞➳❥ ★ ʙɢ.
★ ᴛʀ =͟͟͞͞➳❥ ★ ɢᴇᴛ.
"""
helpMsg2 = """
[CB]-- STAFF COMMAND --
• accept\t: accept the staff role
• abw (word list)\t: add a banned word to the list*
• rbw (word list)\t: remove a banned word from the list*
• sw (message)\t: set the welcome message for new members (will start as soon as the welcome message is set)
• welcome\t: set the welcome channel**
• unwelcome\t: unset the welcome channel**
• ask (message)(lvl=)\t: ask to all level (lvl) something**
• clear (amount)\t: clear the specified amount of message from the chat (max 50)*
• joinall\t: join all public channels
• leaveall\t: leave all public channels
• leaveamino\t: leave the community
• all\t: mention all the users of a channel
• prefix (prefix)\t: set the prefix for the amino
• keepu (user)\t: keep in favorite an user*
• unkeepu (user)\t: remove from favorite an user*
• keepc (chat)\t: keep in favorite a chat*
• unkeepc (chat)\t: remove from favorite a chat*
"""
helpMsg3 = f"""
[CB]-- SPECIAL --
• joinamino (amino id): join the amino (you need to be in the amino's staff)**
• uinfo (user): will give informations about the user²
• cinfo (aminoId): will give informations about the community²
• sendinfo (args): send the info from uinfo or cinfo²
[CB]-- NOTE --
*(only work if bot is in staff)
**(In developpement)
²(only for devlopper or bot owner)
[CI]You want to support my work? You can give me AC!^^
[C]-- all commands are available for the owner of the bot --
"""
help_message = """
--MESSAGES--
0 - BASE
1 - STRIKE
50 - UNSUPPORTED_MESSAGE
57 - REJECTED_VOICE_CHAT
58 - MISSED_VOICE_CHAT
59 - CANCELED_VOICE_CHAT
100 - DELETED_MESSAGE
101 - JOINED_CHAT
102 - LEFT_CHAT
103 - STARTED_CHAT
104 - CHANGED_BACKGROUND
105 - EDITED_CHAT
106 - EDITED_CHAT_ICON
107 - STARTED_VOICE_CHAT
109 - UNSUPPORTED_MESSAGE
110 - ENDED_VOICE_CHAT
113 - EDITED_CHAT_DESCRIPTION
114 - ENABLED_LIVE_MODE
115 - DISABLED_LIVE_MODE
116 - NEW_CHAT_HOST
124 - INVITE_ONLY_CHANGED
125 - ENABLED_VIEW_ONLY
126 - DISABLED_VIEW_ONLY
- chat="chatname": will send the message in the specified chat
"""
helpAsk = """
Example :
- !ask Hello! Can you read this : [poll | http://aminoapp/poll]? Have a nice day!^^ lvl=6
"""
"""
link_list = ["https://amino.com/c/"]
@client.on_message()
def on_message(data):
[data.subClient.delete_message(data.chatId, data.messageId, reason=f"{data.message}", asStaff=True) for elem in link_list if elem in data.message]
"""
JOIN_LEAVE_DETECTOR={}
WARNS = []
ANTI_SPAM = {}
#@client.on_member_join_chat()
#@client.on_member_leave_chat()
def on_join_leave(data):
user_id = data.authorId
if user_id != client.userId:
if JOIN_LEAVE_DETECTOR.get(user_id) is None:
print(user_id)
JOIN_LEAVE_DETECTOR[user_id] = int(time.time())
#print(JOIN_LEAVE_DETECTOR)
elif int(time.time()) - JOIN_LEAVE_DETECTOR[user_id] <= 1:
try:
data.subClient.kick(userId=user_id, chatId=data.chatId, allowRejoin=False)
except:
pass
print("kicked")
#data.subClient.send_message(chatId=data.chatId,message=f"I kicked {data.author} for Join-leave spam")
elif int(time.time()) - JOIN_LEAVE_DETECTOR[user_id] > 1:
JOIN_LEAVE_DETECTOR[user_id] = int(time.time())
#@client.event("on_group_member_join")
def on_antispm(data):
try:
commuId = 195570892
sub_client = client.get_community(int(commuId))
except Exception:
return
args=Parameters(data,sub_client)
lev=sub_client.get_user_info(args.authorId).level
nick=sub_client.get_user_info(args.authorId).nickname
if lev < 3:
try:
sub_client.kick(userId=args.authorId, chatId=args.chatId, allowRejoin=False)
m = sub_client.get_chat_messages(size=5, chatId=args.chatId).messageId
for id in m:
sub_client.delete_message(args.chatId,id)
except:
pass
if "Ayato" in nick:
try:
sub_client.kick(userId=args.authorId, chatId=args.chatId, allowRejoin=False)
except:
pass
#@client.event("on_image_message")
#@client.event("on_text_message")
def on_antispam(data):
try:
commuId = 195570892
sub_client = client.get_community(int(commuId))
except Exception:
return
args=Parameters(data,sub_client)
user_id =args.authorId
if user_id != client.userId:
if ANTI_SPAM.get(user_id) is None:
ANTI_SPAM[user_id] = int(time.time())
elif int(time.time()) - ANTI_SPAM[user_id] <= 0.5:
if WARNS.count(user_id) >= 4:
try:
sub_client.kick(userId=user_id, chatId=args.chatId, allowRejoin=False)
m = sub_client.get_chat_messages(size=10, chatId=args.chatId).messageId
for id in m:
sub_client.delete_message(args.chatId,id)
except:
pass
print(f"{user_id} removed for spam")
for i in WARNS:
if i == user_id:
WARNS.remove(user_id)
else:
WARNS.append(user_id)
elif int(time.time()) - ANTI_SPAM[user_id] > 1:
ANTI_SPAM[user_id] = int(time.time())
for i in WARNS:
if i == user_id:
WARNS.remove(user_id)
#@client.event("on_voice_chat_end")
def on_chat(data):
try:
commuId = 195570892
subClient = client.get_community(int(commuId))
except Exception:
return
args=Parameters(data,subClient)
try:
#print(args.chatId)
if args.chatId in ("4bc4fc90-0ded-401d-9125-7aefd1a59af8","9f246ca7-0b45-4974-af49-9b4ff96f9c0e","48bcd71b-2109-44d1-9a8f-1a60e488481f"):
reset()
except Exception as f:
print(f)
#@client.event("on_screen_room_end")
def on_vhat(data):
try:
commuId = 195570892
subClient = client.get_community(int(commuId))
except Exception:
return
args=Parameters(data,subClient)
try:
#print(args.chatId)
if args.chatId in ("4bc4fc90-0ded-401d-9125-7aefd1a59af8","9f246ca7-0b45-4974-af49-9b4ff96f9c0e","48bcd71b-2109-44d1-9a8f-1a60e488481f"):
reset()
except Exception as f:
print(f)
#@client.event("on_screen_room_end")
def on_cat(data):
try:
commuId = 195570892
subClient = client.get_community(int(commuId))
except Exception:
return
args=Parameters(data,subClient)
try:
#print(args.chatId)
if args.chatId in ("4bc4fc90-0ded-401d-9125-7aefd1a59af8","9f246ca7-0b45-4974-af49-9b4ff96f9c0e","48bcd71b-2109-44d1-9a8f-1a60e488481f"):
reset()
except Exception as f:
print(f)
#@client.event("on_group_member_join")
def on_chat(data):
try:
commuId = 267385755
subClient = client.get_community(int(commuId))
except Exception:
return
args=Parameters(data,subClient)
#print(args
#print(args.chatId)
if args.chatId!="86751255-d3e8-471c-a7f5-670168017302":
#print(args.chatId)
u=subClient.get_user_info(args.authorId).customTitles
if u is None:u=[{"title":""}]
if [obj for obj in u if obj['title'] != 'verified']:
subClient.kick(chatId=args.chatId,userId=args.authorId,allowRejoin=True)
#@client.event("on_avatar_chat_start")
def oat(data):
try:
commuId = 195570892
sub_client = client.get_community(int(commuId))
except Exception:
return
args=Parameters(data,sub_client)
print(args.author)
try:
sub_client.delete_message(args.chatId,args.messageId)
except:
pass
try:
sub_client.kick(userId=args.authorId, chatId=args.chatId, allowRejoin=False)
except:
pass
#@client.event("on_text_message")
def on_chat(data):
try:
commuId = 195570892
subClient = client.get_community(int(commuId))
except Exception:
return
args=Parameters(data,subClient)
#print(args
print(args.chatId)
#@client.event("on_chat_invite")
def on_chat_invite(data):
try:
commuId = 227276247
subClient = client.get_community(commuId)
except Exception:
return
args = Parameters(data, subClient)
subClient.join_chatroom(chatId=args.chatId)
subClient.send_message(args.chatId, f"Hello!\n[B]I am a bot, if you have any question ask a staff member! owner: http://aminoapps.com/p/67y5sw")
#import operator
#@client.on_member_join_chat(condition=chatj)
def verification(data):
try:
#commuId = 227276247
subClient = client.get_community(12719415)
except Exception:
return
#args = Parameters(data, subClient)
with suppress(Exception):
nick=subClient.get_user_info(data.authorId).nickname
if not "✓" in nick:
subClient.kick(chatId=data.chatId,userId=data.authorId,allowRejoin=True)
##@client.on_message(condition=chatj)
def verificati(data):
try:
commuId = 267385755
subClient = client.get_community(int(267385755))
except Exception:
return
#args = Parameters(data, subClient)
if data.authorId!="6959294f-dc51-47b0-9fc6-16c1ce0d5520":
ff=data.message
if str(len(f"{ff}"))!="6":
subClient.delete_message(messageId=data.messageId,chatId=data.chatId,asStaff=True,reason="only for code")
#with suppress(Exception):
#if not "✓" in nick:
#subClient.kick(chatId=data.chatId,userId=data.authorId,allowRejoin=True)
@client.on_all()
def on_message(data):
content = data.message
#print(content)
mtype = data.info.message.type
if (mtype == 100) | (mtype == 109) | (mtype == 107) | (mtype == 110) | (mtype == 108) | (mtype == 111) | (mtype == 55) | (mtype == 56) | (mtype == 57) | (mtype == 58) | (mtype == 59) | (mtype == 60):
if data.comId==195570892:
if content is None:
#print("jk")
pass
else:
#print("yes")
#subClient = client.get_community(int(267385755))
lista=data.subClient.get_chat_thread(data.chatId).coHosts
if client.userId in lista:
try: data.subClient.delete_message(data.chatId,data.messageId)
except: pass
try: data.subClient.kick(chatId=data.chatId, userId=data.authorId, allowRejoin=False)
except: pass
#print("ghjk")
#try:
#data.subClient.kick(chatId=data.chatId, userId=data.authorId, allowRejoin=False)
#data.subClient.delete_message(data.chatId,data.messageId)
#except:
#pass
#@client.on_member_join_chat(condition=tapp)
def say_yo(data):
try:
u=data.subClient.get_user_info(data.authorId).customTitles
if u is None:u=[]
if [obj for obj in u if obj['title'] == 'verified']:
subClient.kick(chatId=data.chatId,userId=data.authorId,allowRejoin=True)
except:
pass
def maintenance():
print("launch maintenance")
i = 0
while i < 7200:
i += 10
time.sleep(10)
os.execv(sys.executable, ["None", os.path.basename(sys.argv[0])])
client.launch(True)
Thread(target=maintenance).start()
def reconsocketloop():
while True:
client.close()
client.run_amino_socket()
sleep(120)
socketloop = threading.Thread(target=reconsocketloop, daemon=True)
socketloop.start()
print("Ready")Editor is loading...