Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import telepot
- import random
- from random import shuffle
- import urbandict
- from random_words import RandomWords
- from collections import Counter
- import threading
- import json
- import subprocess
- import io
- import string
- import sqlite3
- import telegram
- import requests
- from PIL import Image, ImageFilter
- from PIL import ImageOps
- from collections import Counter
- import sys
- import re
- from threading import Thread
- import time
- from telepot.namedtuple import ReplyKeyboardMarkup, ReplyKeyboardRemove, InlineKeyboardMarkup, InlineKeyboardButton, \
- KeyboardButton
- import PIL
- from PIL import Image, ImageFont, ImageDraw
- from PIL import ImageEnhance
- import datetime
- import os
- from gtts import gTTS
- def handle(msg):
- #FILES AND DIRECTORIES
- if 'from' in msg:
- messageFromID = msg['from']['id']
- else:
- messageFromID = 'None'
- if 'type' in msg:
- messageType = msg['chat']['type']
- else:
- messageType = "None"
- try:
- messageType = msg['chat']['type']
- except:
- messagType = 'None'
- if messageType != 'private':
- isPrivateMessage = False
- toSend = True
- isGroup = True
- else:
- isPrivateMessage = True
- toSend = False
- isGroup = False
- if 'chat' in msg:
- chat_id = msg['chat']['id']
- else:
- chat_id = "None"
- if 'data' in msg:
- global warnd
- isInlineResponse = True
- messageInlineData = msg['data']
- print(messageInlineData)
- else:
- isInlineResponse = False
- messageInlineData = 'None'
- global warnd
- global promoted
- if 'message_id' in msg:
- messageID = str(msg['message_id'])
- else:
- messageID = 'None'
- if messageType != 'private':
- if not os.path.exists(str(chat_id)):
- os.makedirs(str(chat_id))
- os.makedirs(str(chat_id) + "/messages/")
- os.makedirs(str(chat_id) + "/rooms/")
- os.makedirs(str(chat_id) + "/data/")
- if not os.path.exists("data/"):
- os.makedirs("data/")
- if not os.path.exists("login/"):
- os.makedirs("login/")
- if os.path.isfile("data/usernames.txt") == False:
- open("data/usernames.txt", "w").write("admin\nspoon\n")
- if os.path.isfile(str(chat_id) + "/data/tts.txt") == False:
- open(str(chat_id) + "/data/tts.txt", "w").write("True")
- if os.path.isfile(str(chat_id) + "/data/imagecolor.txt") == False:
- open(str(chat_id) + "/data/imagecolor.txt", "w").write("black")
- if os.path.isfile(str(chat_id) + "/data/textcolor.txt") == False:
- open(str(chat_id) + "/data/textcolor.txt", "w").write("white")
- if os.path.isfile(str(chat_id) + "/data/gamelimit.txt") == False:
- open(str(chat_id) + "/data/gamelimit.txt", "w").write("30")
- if os.path.isfile(str(chat_id) + "/data/greet.txt") == False:
- open(str(chat_id) + "/data/greet.txt", "w").write("Text")
- if os.path.isfile(str(chat_id) + "/data/games.txt") == False:
- open(str(chat_id) + "/data/games.txt", "w").write("True")
- if os.path.isfile(str(chat_id) + "/data/word.txt") == False:
- open(str(chat_id) + "/data/word.txt", "w").write("True")
- if os.path.isfile(str(chat_id) + "/data/admin.txt") == False:
- open(str(chat_id) + "/data/admin.txt", "w").write
- if os.path.isfile(str(chat_id) + "/data/jokes.txt") == False:
- open(str(chat_id) + "/data/jokes.txt", "w").write("False")
- if os.path.isfile(str(chat_id) + "/data/limit.txt") == False:
- open(str(chat_id) + "/data/limit.txt", "w").write("750")
- if os.path.isfile(str(chat_id) + "/data/8ball.txt") == False:
- open(str(chat_id) + "/data/8ball.txt", "w").write("False")
- if os.path.isfile(str(chat_id) + "/data/scramble.txt") == False:
- open(str(chat_id) + "/data/scramble.txt", "w").write('False')
- if os.path.isfile(str(chat_id) + "/data/roll.txt") == False:
- open(str(chat_id) + "/data/roll.txt", "w").write("False")
- if os.path.isfile(str(chat_id) + "/data/temp.txt") == False:
- open(str(chat_id) + "/data/temp.txt", "w")
- if os.path.isfile(str(chat_id) + "/data/lock.txt") == False:
- open(str(chat_id) + "/data/lock.txt", "w").write("False")
- if os.path.isfile(str(chat_id) + "/data/game.txt") == False:
- open(str(chat_id) + "/data/game.txt", "w").write("True")
- if os.path.isfile(str(chat_id) + "/data/pong.txt") == False:
- open(str(chat_id) + "/data/pong.txt", "w").write("False")
- if os.path.isfile(str(chat_id) + "/data/mm.txt") == False:
- open(str(chat_id) + "/data/mm.txt", "w").write("False")
- if os.path.isfile(str(chat_id) + "/data/games.txt") == False:
- open(str(chat_id) + "/data/games.txt", "w").write("False")
- if os.path.isfile(str(chat_id) + "/data/antibot.txt") == False:
- open(str(chat_id) + "/data/antibot.txt", "w").write("False")
- if os.path.isfile(str(chat_id) + "/data/flip.txt") == False:
- open(str(chat_id) + "/data/flip.txt", "w").write("False")
- if os.path.isfile(str(chat_id) + "/data/blacklist.txt") == False:
- open(str(chat_id) + "/data/blacklist.txt", "w")
- if os.path.isfile(str(chat_id) + "/data/blacklistusername.txt") == False:
- open(str(chat_id) + "/data/blacklistusername.txt", "w")
- if os.path.isfile(str(chat_id) + "/data/wel.txt") == False:
- open(str(chat_id) + "/data/wel.txt", "w").write("True")
- if os.path.isfile(str(chat_id) + "/data/photo.txt") == False:
- open(str(chat_id) + "/data/photo.txt", "w").write("True")
- if os.path.isfile(str(chat_id) + "/data/admin.txt") == False:
- open(str(chat_id) + "/data/admin.txt", "w")
- if os.path.isfile(str(chat_id) + "/data/remind.txt") == False:
- open(str(chat_id) + "/data/remind.txt", "w").write("False")
- if os.path.isfile(str(chat_id) + "/data/tts.txt") == False:
- open(str(chat_id) + "/data/tts.txt", "w").write("False")
- if os.path.isfile(str(chat_id) + "/wel.txt") == False:
- if messageType != 'private':
- open(str(chat_id) + "/wel.txt", "w").write("True")
- #DEFINE MESSAGES
- if os.path.isfile(str(chat_id) + "/data/photo.txt") == False:
- open(str(chat_id) + "/data/photo.txt", "w").write("True")
- if os.path.isfile(str(chat_id) + "/data/8ball.txt") == False:
- open(str(chat_id) + "/data/8ball.txt", "w").write("True")
- if 'text' in msg:
- if messageType != 'private':
- if os.path.isfile("rooms/" + str(messageFromID) + "wins.txt") == False:
- open("rooms/" + str(messageFromID) + "wins.txt", "w").write("0")
- if os.path.isfile("rooms/" + str(messageFromID) + "money.txt") == False:
- open("rooms/" + str(messageFromID) + "money.txt", "w").write("100")
- if os.path.isfile(str(chat_id) + "/messagecount.txt") == False:
- open(str(chat_id) + "/messagecount.txt", "w").write("1")
- else:
- minus = int(str(open(str(chat_id) + "/messagecount.txt", "r+").readlines()).replace("[", "").replace("'", "").replace("]", "")) + 1
- open(str(chat_id) + "/messagecount.txt", "w").write(str(minus))
- if os.path.isfile(
- str(chat_id) +
- "/messages/" + str(messageFromID) + ".txt") == False:
- open(
- str(chat_id) +
- "/messages/" + str(messageFromID) + ".txt", "w").write("1")
- else:
- minus = int(
- str(open(
- str(chat_id) +
- "/messages/" + str(messageFromID) + ".txt", "r+").readlines()).replace("[", "").replace(
- "'", "").replace("]", "")) + 1
- open(
- str(chat_id) +
- "/messages/" + str(messageFromID) + ".txt", "w").write(str(minus))
- message = msg['text'].lower()
- if isPrivateMessage == False:
- print(msg['chat']['title'], ', ', msg['from']['first_name'], ':\n', msg['text'])
- else:
- print('Private Message, ', msg['from']['first_name'], ':\n', msg['text'])
- else:
- message = 'None'
- if 'username' in msg['from']:
- username = str("@" + msg['from']['username'])
- else:
- username = msg['from']['first_name']
- if 'caption' in msg:
- caption = msg['caption']
- else:
- caption = 'None'
- if 'voice' in msg:
- voiceMessage = msg['voice']['file_id']
- else:
- voiceMessage = 'None'
- if 'photo' in msg:
- print(str(msg['from']['first_name']) + " sent a photo.")
- if messageType != 'private':
- if os.path.isfile("rooms/" + str(messageFromID) + "wins.txt") == False:
- open("rooms/" + str(messageFromID) + "wins.txt", "w").write("0")
- if os.path.isfile("rooms/" + str(messageFromID) + "money.txt") == False:
- open("rooms/" + str(messageFromID) + "money.txt", "w").write("100")
- if os.path.isfile(str(chat_id) + "/messagecount.txt") == False:
- open(str(chat_id) + "/messagecount.txt", "w").write("1")
- else:
- minus = int(str(open(str(chat_id) + "/messagecount.txt", "r+").readlines()).replace("[", "").replace(
- "'", "").replace("]", "")) + 1
- open(str(chat_id) + "/messagecount.txt", "w").write(str(minus))
- if os.path.isfile(
- str(chat_id) +
- "/messages/" + str(messageFromID) + ".txt") == False:
- open(
- str(chat_id) +
- "/messages/" + str(messageFromID) + ".txt", "w").write("1")
- else:
- minus = int(
- str(open(
- str(chat_id) +
- "/messages/" + str(messageFromID) + ".txt", "r+").readlines()).replace("[", "").replace(
- "'", "").replace("]", "")) + 1
- open(
- str(chat_id) +
- "/messages/" + str(messageFromID) + ".txt", "w").write(str(minus))
- photo = msg['photo']
- else:
- photo = 'None'
- if 'reply_to_message' in msg:
- messageReply = msg['reply_to_message']['from']['id']
- else:
- messageReply = 'None'
- if 'sticker' in msg:
- print(msg['from']['first_name'] + " sent a sticker.")
- if messageType != 'private':
- if os.path.isfile("rooms/" + str(messageFromID) + "wins.txt") == False:
- open("rooms/" + str(messageFromID) + "wins.txt", "w").write("0")
- if os.path.isfile("rooms/" + str(messageFromID) + "money.txt") == False:
- open("rooms/" + str(messageFromID) + "money.txt", "w").write("100")
- if os.path.isfile(str(chat_id) + "/messagecount.txt") == False:
- open(str(chat_id) + "/messagecount.txt", "w").write("1")
- else:
- minus = int(str(open(str(chat_id) + "/messagecount.txt", "r+").readlines()).replace("[", "").replace(
- "'", "").replace("]", "")) + 1
- open(str(chat_id) + "/messagecount.txt", "w").write(str(minus))
- if os.path.isfile(
- str(chat_id) +
- "/messages/" + str(messageFromID) + ".txt") == False:
- open(
- str(chat_id) +
- "/messages/" + str(messageFromID) + ".txt", "w").write("1")
- else:
- minus = int(
- str(open(
- str(chat_id) +
- "/messages/" + str(messageFromID) + ".txt", "r+").readlines()).replace("[", "").replace(
- "'", "").replace("]", "")) + 1
- open(
- str(chat_id) +
- "/messages/" + str(messageFromID) + ".txt", "w").write(str(minus))
- if 'data' in msg:
- global warnd
- isInlineResponse = True
- messageInlineData = msg['data']
- print(messageInlineData)
- else:
- isInlineResponse = False
- messageInlineData = 'None'
- global warnd
- global promoted
- messageFromID = messageFromID
- #DEFINE COMMANDS
- eightball = ["Not so sure", "That could be possible", "Most likely", "Absolutely not", "Outlook is good",
- "I see good things happening", "Never",
- "Negative", "Could be", "Unclear, ask again", "Yes", "No", "Possible, but not probable"]
- jokes = ["Why did the boy drop his ice cream? Because he was hit by a bus.", "A dyslexic man walks into a bra.",
- "What is green and has wheels. Grass, I lied about the wheels.",
- "What is red and smells like blue paint? Red paint.",
- "Knock knock. Who's there? Dave. Dave who? Dave began to break into tears as his Grandmother's Alzheimer's had gotten progressively worse.",
- "What is brown and sticky? A stick.",
- "A horse walked into a bar. Several people got up and left as they spotted the potential danger in the situation.",
- "How do you make a plumber cry? You kill his family.",
- "A man walks into a bar, he is an alcoholic and he is ruining his family.",
- "What does an Eagle and a Mole have in common? They both live underground. Apart from the Eagle.",
- "Why did Suzie fall off the swing? She had no arms.",
- "A duck walks into a bar, the bartender says 'What'll it be?' The duck doesn't say anything because it is a duck.",
- "A dog walks into a bar and asks for a drink. The bartender goes to get him a drink, but then realizes how ridiculous this is and wakes up from his dream. He rolls over to tell his wife about it, but she ignores him. He begins to cry silently, realizing his marriage is in shambles."]
- commandsList = ['hi bot', '/gt', '/scramble', "/m8", "/toggles", "/magic8", "/pin", '/polaroid', '/color', '/colour', '/start', '/rblur', '/swirl', '/help', "/greet", "/eb", '/com', '/id', '/google', '/title', '/time', '/give', '/stick', '/chatid', '/pin', '/unban', '/ud', '/slap', '/promote', '/demote', '/unmute', 'hey bot', '/unban', '/byebot', '/rt', "/roll", '/wt', "/warn", "/wel", "/check", "/reset", "/callme", "/forget", "/imagesearch", "/ban", "/kick", "/contour", "/invert", "/saturate", "/posterize", "/equalize", "/blur", "/sharpen", "/solarize", "/caption", "/photo"]
- def getpfp():
- try:
- if 'reply_to_message' in msg:
- Bot.send_chat_action(chat_id, action=telegram.ChatAction.TYPING)
- profiles = bot.getUserProfilePhotos(msg['reply_to_message']['from']['id'])
- file_id = profiles['photos'][0][2]['file_id']
- filename = str(msg['reply_to_message']['from']['id']) + ".jpg"
- bot.download_file(file_id, filename)
- bot.sendPhoto(messageFromID, open(filename, "rb"))
- os.remove(filename)
- else:
- bot.sendMessage(chat_id, "Reply to someone.")
- except:
- bot.sendMessage(chat_id, "You have to PM first in order to receive private messages.")
- if "/getpfp" in message:
- t = threading.Thread(target=getpfp)
- t.start()
- def caption():
- Bot.send_chat_action(chat_id, action=telegram.ChatAction.TYPING)
- numbe = msg['text'][9:]
- size = numbe.split("::")[1]
- number = numbe.split("::", 1)[0]
- file_id = msg['reply_to_message']['photo'][2]['file_id']
- filename = str(msg['reply_to_message']['from']['id']) + ".jpg"
- bot.download_file(file_id, filename)
- img = PIL.Image.open(filename)
- draw = PIL.ImageDraw.Draw(img)
- w, h = img.size
- font = ImageFont.truetype("comic.ttf", int(size))
- text_w, text_h = draw.textsize(number, font)
- draw.text(((w - text_w) // 2, h - text_h), number, (255, 255, 255), font=font)
- img.save("1" + filename)
- bot.sendPhoto(chat_id, open("1" + filename, "rb"))
- os.remove(filename)
- os.remove("1" + filename)
- def rblur():
- if chat_id == -1001088621659:
- ()
- else:
- file_id = msg['reply_to_message']['photo'][2]['file_id']
- filename = str(msg['reply_to_message']['from']['id']) + ".jpg"
- bot.download_file(file_id, filename)
- bashCommand = "convert " + str(msg['reply_to_message']['from']['id']) + ".jpg" + " -radial-blur 10 " + str(
- msg['reply_to_message']['from']['id']) + ".jpg"
- subprocess.check_output(['bash', '-c', bashCommand])
- bot.sendPhoto(chat_id, open(str(msg['reply_to_message']['from']['id']) + ".jpg", "rb"))
- os.remove(filename)
- def swirl():
- if chat_id == -1001088621659:
- ()
- else:
- file_id = msg['reply_to_message']['photo'][2]['file_id']
- filename = str(msg['reply_to_message']['from']['id']) + ".jpg"
- bot.download_file(file_id, filename)
- bashCommand = "convert " + str(msg['reply_to_message']['from']['id']) + ".jpg" + " -swirl 180 " + str(
- msg['reply_to_message']['from']['id']) + ".jpg"
- subprocess.check_output(['bash', '-c', bashCommand])
- bot.sendPhoto(chat_id, open(str(msg['reply_to_message']['from']['id']) + ".jpg", "rb"))
- os.remove(filename)
- def polar():
- text = msg['text'][10:]
- file_id = msg['reply_to_message']['photo'][2]['file_id']
- filename = str(msg['reply_to_message']['from']['id']) + ".png"
- bot.download_file(file_id, filename)
- bashCommand = "convert -caption '" + str(text) + "' \
- " + filename + " -thumbnail 480x480 \
- -bordercolor Lavender -border 5x5 -density 144 \
- -gravity center -pointsize 20 -background black \
- -polaroid -15 -resize 50% " + filename
- subprocess.check_output(['bash', '-c', bashCommand])
- bot.sendPhoto(chat_id, open(filename, "rb"))
- os.remove(filename)
- if "/polaroid" in message:
- if "True" in open(str(chat_id) + "/data/photo.txt"):
- t = threading.Thread(target=polar)
- t.start()
- if "/swirl" in message:
- if "True" in open(str(chat_id) + "/data/photo.txt"):
- t = threading.Thread(target=swirl)
- t.start()
- def saturatee():
- if "True" in open(str(chat_id) + "/data/photo.txt"):
- if 'reply_to_message' in msg:
- try:
- Bot.send_chat_action(chat_id, action=telegram.ChatAction.TYPING)
- number = message[10:]
- file_id = msg['reply_to_message']['photo'][2]['file_id']
- filename = str(msg['reply_to_message']['from']['id']) + ".jpg"
- bot.download_file(file_id, filename)
- img = PIL.Image.open(filename)
- convert = PIL.ImageEnhance.Color(img)
- img2 = convert.enhance(int(number))
- img2.save("1" + filename)
- bot.sendPhoto(chat_id, open("1" + filename, "rb"))
- os.remove(filename)
- os.remove("1" + filename)
- except:
- ()
- else:
- bot.sendMessage(chat_id, "Reply to a photo.")
- def contour():
- if "True" in open(str(chat_id) + "/data/photo.txt"):
- if 'reply_to_message' in msg:
- try:
- Bot.send_chat_action(chat_id, action=telegram.ChatAction.TYPING)
- number = message[10:]
- file_id = msg['reply_to_message']['photo'][2]['file_id']
- filename = str(msg['reply_to_message']['from']['id']) + ".jpg"
- bot.download_file(file_id, filename)
- im = filename
- img = PIL.Image.open(im)
- im1 = img.filter(ImageFilter.CONTOUR)
- im1.save("1" + filename)
- bot.sendPhoto(chat_id, open("1" + filename, "rb"))
- os.remove(filename)
- os.remove("1" + filename)
- except:
- ()
- else:
- bot.sendMessage(chat_id, "Reply to a photo.")
- def blur():
- if "True" in open(str(chat_id) + "/data/photo.txt"):
- if 'reply_to_message' in msg:
- try:
- Bot.send_chat_action(chat_id, action=telegram.ChatAction.TYPING)
- number = message[5:]
- file_id = msg['reply_to_message']['photo'][2]['file_id']
- filename = str(msg['reply_to_message']['from']['id']) + ".jpg"
- bot.download_file(file_id, filename)
- im = filename
- img = PIL.Image.open(im)
- im1 = img.filter(ImageFilter.GaussianBlur(radius=int(number)))
- im1.save("1" + filename)
- bot.sendPhoto(chat_id, open("1" + filename, "rb"))
- os.remove(filename)
- os.remove("1" + filename)
- except:
- ()
- else:
- bot.sendMessage(chat_id, "Reply to a photo.")
- def sharpen():
- if 'reply_to_message' in msg:
- try:
- Bot.send_chat_action(chat_id, action=telegram.ChatAction.TYPING)
- file_id = msg['reply_to_message']['photo'][2]['file_id']
- filename = str(msg['reply_to_message']['from']['id']) + ".jpg"
- bot.download_file(file_id, filename)
- im = filename
- img = PIL.Image.open(im)
- im1 = img.filter(ImageFilter.EDGE_ENHANCE_MORE)
- im1.save("1" + filename)
- bot.sendPhoto(chat_id, open("1" + filename, "rb"))
- os.remove(filename)
- os.remove("1" + filename)
- except:
- ()
- def solarize():
- if "True" in open(str(chat_id) + "/data/photo.txt"):
- if 'reply_to_message' in msg:
- try:
- Bot.send_chat_action(chat_id, action=telegram.ChatAction.TYPING)
- number = message[10:]
- file_id = msg['reply_to_message']['photo'][2]['file_id']
- filename = str(msg['reply_to_message']['from']['id']) + ".jpg"
- bot.download_file(file_id, filename)
- img = PIL.Image.open(filename)
- convert = PIL.ImageOps.solarize(img, threshold=128)
- convert.save("1" + filename)
- bot.sendPhoto(chat_id, open("1" + filename, "rb"))
- os.remove(filename)
- os.remove("1" + filename)
- except:
- ()
- else:
- bot.sendMessage(chat_id, "Reply to a photo.")
- if "/solarize" in message:
- t = threading.Thread(target=solarize)
- t.start()
- def equalize():
- if "True" in open(str(chat_id) + "/data/photo.txt"):
- if 'reply_to_message' in msg:
- try:
- Bot.send_chat_action(chat_id, action=telegram.ChatAction.TYPING)
- number = message[10:]
- file_id = msg['reply_to_message']['photo'][2]['file_id']
- filename = str(msg['reply_to_message']['from']['id']) + ".jpg"
- bot.download_file(file_id, filename)
- img = PIL.Image.open(filename)
- convert = PIL.ImageOps.equalize(img)
- convert.save("1" + filename)
- bot.sendPhoto(chat_id, open("1" + filename, "rb"))
- os.remove(filename)
- os.remove("1" + filename)
- except:
- ()
- else:
- bot.sendMessage(chat_id, "Reply to a photo.")
- if "/equalize" in message:
- t = threading.Thread(target=solarize)
- t.start()
- def posterize():
- if "True" in open(str(chat_id) + "/data/photo.txt"):
- if 'reply_to_message' in msg:
- try:
- Bot.send_chat_action(chat_id, action=telegram.ChatAction.TYPING)
- number = message[10:]
- file_id = msg['reply_to_message']['photo'][2]['file_id']
- filename = str(msg['reply_to_message']['from']['id']) + ".jpg"
- bot.download_file(file_id, filename)
- img = PIL.Image.open(filename)
- convert = PIL.ImageOps.posterize(img, 2)
- convert.save("1" + filename)
- bot.sendPhoto(chat_id, open("1" + filename, "rb"))
- os.remove(filename)
- os.remove("1" + filename)
- except:
- ()
- else:
- bot.sendMessage(chat_id, "Reply to a photo.")
- if "/posterize" in message:
- t = threading.Thread(target=posterize)
- t.start()
- def invert():
- if "True" in open(str(chat_id) + "/data/photo.txt"):
- if 'reply_to_message' in msg:
- try:
- Bot.send_chat_action(chat_id, action=telegram.ChatAction.TYPING)
- number = message[10:]
- file_id = msg['reply_to_message']['photo'][2]['file_id']
- filename = str(msg['reply_to_message']['from']['id']) + ".jpg"
- bot.download_file(file_id, filename)
- img = PIL.Image.open(filename)
- convert = PIL.ImageOps.invert(img)
- convert.save("1" + filename)
- bot.sendPhoto(chat_id, open("1" + filename, "rb"))
- os.remove(filename)
- os.remove("1" + filename)
- except:
- ()
- else:
- bot.sendMessage(chat_id, "Reply to a photo.")
- if "/invert" in message:
- t = threading.Thread(target=invert)
- t.start()
- def saturate():
- try:
- Bot.send_chat_action(chat_id, action=telegram.ChatAction.TYPING)
- file_id = msg['reply_to_message']['photo'][2]['file_id']
- filename = str(msg['reply_to_message']['from']['id']) + ".jpg"
- bot.download_file(file_id, filename)
- img = PIL.Image.open(filename)
- convert = PIL.ImageEnhance.Color(img)
- img2 = convert.enhance(10)
- img2.save("1" + filename)
- bot.sendPhoto(chat_id, open("1" + filename, "rb"))
- os.remove(filename)
- os.remove("1" + filename)
- except:
- bot.sendMessage(chat_id, "/saturate <Amount of saturation in numbers>")
- def captionb():
- Bot.send_chat_action(chat_id, action=telegram.ChatAction.TYPING)
- if "True" in open(str(chat_id) + "/data/photo.txt", "r"):
- if 'reply_to_message' in msg:
- try:
- numbe = msg['text'][10:]
- size = numbe.split("::")[1]
- number = numbe.split("::", 1)[0]
- file_id = msg['reply_to_message']['photo'][2]['file_id']
- filename = str(msg['reply_to_message']['from']['id']) + ".jpg"
- bot.download_file(file_id, filename)
- img = PIL.Image.open(filename)
- draw = PIL.ImageDraw.Draw(img)
- w, h = img.size
- font = ImageFont.truetype("comic.ttf", int(size))
- text_w, text_h = draw.textsize(number, font)
- draw.text(((w - text_w) // 2, h - text_h), number, (0, 0, 0), font=font)
- img.save("1" + filename)
- bot.sendPhoto(chat_id, open("1" + filename, "rb"))
- os.remove(filename)
- os.remove("1" + filename)
- except:
- ()
- else:
- bot.sendMessage(chat_id, "Reply to a photo.")
- def captionerror():
- bot.sendMessage(chat_id, "/caption text::textsize (in numbers)")
- def captionerrorb():
- bot.sendMessage(chat_id, "/captionb text::textsize (in numbers)")
- if message == "/caption":
- if "True" in open(str(chat_id) + "/data/photo.txt", "r"):
- t = threading.Thread(target=captionerror)
- t.start()
- if "/caption " in message:
- if "True" in open(str(chat_id) + "/data/photo.txt", "r"):
- if 'reply_to_message' in msg:
- t = threading.Thread(target=caption)
- t.start()
- else:
- bot.sendMessage(chat_id, "Please reply to a photo.")
- if "/rblur" in message:
- if "True" in open(str(chat_id) + "/data/photo.txt", "r"):
- if 'reply_to_message' in msg:
- t = threading.Thread(target=rblur)
- t.start()
- else:
- bot.sendMessage(chat_id, "Please reply to a photo.")
- if message == "/captionb":
- if "True" in open(str(chat_id) + "/data/photo.txt", "r"):
- t = threading.Thread(target=captionerrorb)
- t.start()
- if message.startswith("/captionb "):
- if "True" in open(str(chat_id) + "/data/photo.txt", "r"):
- if 'reply_to_message' in msg:
- t = threading.Thread(target=captionb)
- t.start()
- else:
- bot.sendMessage(chat_id, "Please reply to a photo.")
- if message == "/saturate":
- if "True" in open(str(chat_id) + "/data/photo.txt", "r"):
- if 'reply_to_message' in msg:
- t = threading.Thread(target=saturate)
- t.start()
- else:
- bot.sendMessage(chat_id, "Please respond to a photo.")
- if "/contour" in message:
- if "True" in open(str(chat_id) + "/data/photo.txt", "r"):
- if 'reply_to_message' in msg:
- t = threading.Thread(target=contour)
- t.start()
- else:
- bot.sendMessage(chat_id, "Please respond to a photo.")
- if "/blur " in message:
- if "True" in open(str(chat_id) + "/data/photo.txt", "r"):
- if 'reply_to_message' in msg:
- t = threading.Thread(target=blur)
- t.start()
- else:
- bot.sendMessage(chat_id, "Please respond to a photo.")
- if "/sharpen" in message:
- if "True" in open(str(chat_id) + "/data/photo.txt", "r"):
- if 'reply_to_message' in msg:
- t = threading.Thread(target=sharpen)
- t.start()
- else:
- bot.sendMessage(chat_id, "Please respond to a photo.")
- if message.startswith("/saturate "):
- if "True" in open(str(chat_id) + "/data/photo.txt", "r"):
- if 'reply_to_message' in msg:
- t = threading.Thread(target=saturatee)
- t.start()
- else:
- bot.sendMessage(chat_id, "Please respond to a photo.")
- def imagesearch():
- if 'reply_to_message' in msg:
- Bot.send_chat_action(chat_id, action=telegram.ChatAction.TYPING)
- file_id = msg['reply_to_message']['photo'][2]['file_id']
- filename = str(msg['reply_to_message']['from']['id']) + str(random.randint(1, 100000)) + ".jpg"
- bot.download_file(file_id, "/home6/dylanisa/public_html/" + filename)
- google = str("https://www.google.com/searchbyimage?&image_url=dylanisaturtle.com/" + filename)
- bot.sendMessage(chat_id, "[Image Searched!]" + "(" + google + ")",
- reply_to_message_id=msg['message_id'],
- parse_mode="markdown", disable_web_page_preview=True)
- os.remove(filename)
- else:
- bot.sendMessage(chat_id, "Reply to a photo.")
- def toggle():
- if "True" in open(str(chat_id) + "/data/jokes.txt", "r"):
- Jks = "*On*"
- if "False" in open(str(chat_id) + "/data/jokes.txt", "r"):
- Jks = "*Off*"
- if "True" in open(str(chat_id) + "/data/8ball.txt", "r"):
- eB = "*On*"
- if "False" in open(str(chat_id) + "/data/8ball.txt", "r"):
- eB = "*Off*"
- if "True" in open(str(chat_id) + "/data/roll.txt", "r"):
- rL = "*On*"
- if "False" in open(str(chat_id) + "/data/roll.txt", "r"):
- rL = "*Off*"
- if "True" in open(str(chat_id) + "/data/lock.txt", "r"):
- gL = "*On*"
- if "False" in open(str(chat_id) + "/data/lock.txt", "r"):
- gL = "*Off*"
- if "True" in open(str(chat_id) + "/data/pong.txt", "r"):
- pL = "*On*"
- if "False" in open(str(chat_id) + "/data/pong.txt", "r"):
- pL = "*Off*"
- if "True" in open(str(chat_id) + "/data/mm.txt", "r"):
- mL = "*On*"
- if "False" in open(str(chat_id) + "/data/mm.txt", "r"):
- mL = "*Off*"
- if "True" in open(str(chat_id) + "/data/antibot.txt", "r"):
- aB = "*On*"
- if "False" in open(str(chat_id) + "/data/antibot.txt", "r"):
- aB = "*Off*"
- if "True" in open(str(chat_id) + "/data/flip.txt", "r"):
- fL = "*On*"
- if "False" in open(str(chat_id) + "/data/flip.txt", "r"):
- fL = "*Off*"
- if "True" in open(str(chat_id) + "/data/photo.txt", "r"):
- pT = "*On*"
- if "False" in open(str(chat_id) + "/data/photo.txt", "r"):
- pT = "*Off*"
- bot.sendMessage(chat_id,
- "Jokes: " + Jks + "\nMagic 8Ball: " + eB + "\nRolling: " + rL + "\nGroup Lock: " + gL + "\nPing/Pong: " + pL + "\nMake me: " + mL + "\nAntibot: " + aB + "\nFlip: " + fL + "\nPhoto edit: " + pT, parse_mode='markdown')
- def roll2():
- edited = telepot.message_identifier(bot.sendMessage(chat_id, 'Rolling two dice...'))
- time.sleep(0.7)
- rollrandom = str(random.randint(1, 6))
- rollrandom2 = str(random.randint(1, 6))
- bot.editMessageText(edited, "*" + str(rollrandom) + "* and a", parse_mode="markdown")
- time.sleep(0.5)
- bot.editMessageText(edited, "*" + str(rollrandom) + "*" + " and a " + "*" + str(rollrandom2) + "*",
- parse_mode="markdown")
- def roll1():
- edited = telepot.message_identifier(bot.sendMessage(chat_id, 'Rolling a single dice'))
- time.sleep(0.7)
- bot.editMessageText(edited, "*" + str(random.randint(1, 6)) + "*", parse_mode="markdown")
- if message == "/roll":
- if "True" in open(str(chat_id) + "/data/roll.txt", "r"):
- t = threading.Thread(target=roll1)
- t.start()
- if "/roll2" in message:
- if "True" in open(str(chat_id) + "/data/roll.txt", "r"):
- t = threading.Thread(target=roll2)
- t.start()
- if "/id" in message:
- try:
- bot.sendMessage(chat_id, msg['reply_to_message']['from']['id'])
- except:
- bot.sendMessage(chat_id, messageFromID)
- if "/chatid" in message:
- bot.sendMessage(chat_id, chat_id)
- if "/com" in message:
- bot.sendMessage(chat_id, "Commands:\n/roll and /roll2\n/saturate\n/solarize\n/posterize\n/swirl\n/polaroid\n/rblur\n/caption and /captionb for black text\n/kickme\n/def\n/jokes\n/callme\n/blur\n/contour\n/check\n/equalize\n/sharpen\n/invert\n/equalize\n/imagesearch")
- if message == "/kickme":
- try:
- bot.kickChatMember(chat_id, messageFromID)
- bot.unbanChatMember(chat_id, messageFromID)
- except:
- bot.sendMessage(chat_id, "Oops! Either you're admin, or I am not admin.")
- if os.path.isfile(str(chat_id) + "/data/c" + str(message).replace("/", "slas12") + ".txt") == True:
- bot.sendMessage(chat_id, str(open(str(chat_id) + "/data/c" + str(message).replace("/", "slas12") + ".txt", "r").read()))
- else:
- f = ""
- lines = ""
- def admincom():
- if "/color" in message:
- if "green" in message:
- open(str(chat_id) + "/data/imagecolor.txt", "w").write("green")
- open(str(chat_id) + "/data/textcolor.txt", "w").write("black")
- bot.sendMessage(chat_id, "Color set to green.")
- elif "red" in message:
- open(str(chat_id) + "/data/imagecolor.txt", "w").write("red")
- open(str(chat_id) + "/data/textcolor.txt", "w").write("black")
- bot.sendMessage(chat_id, "Color set to red.")
- elif "blue" in message:
- open(str(chat_id) + "/data/imagecolor.txt", "w").write("blue")
- open(str(chat_id) + "/data/textcolor.txt", "w").write("white")
- bot.sendMessage(chat_id, "Color set to blue.")
- elif "black" in message:
- open(str(chat_id) + "/data/imagecolor.txt", "w").write("black")
- open(str(chat_id) + "/data/textcolor.txt", "w").write("white")
- bot.sendMessage(chat_id, "Color set to black.")
- elif "white" in message:
- open(str(chat_id) + "/data/imagecolor.txt", "w").write("white")
- open(str(chat_id) + "/data/textcolor.txt", "w").write("black")
- bot.sendMessage(chat_id, "Color set to white.")
- elif "orange" in message:
- open(str(chat_id) + "/data/imagecolor.txt", "w").write("orange")
- open(str(chat_id) + "/data/textcolor.txt", "w").write("black")
- bot.sendMessage(chat_id, "Color set to orange.")
- elif "yellow" in message:
- open(str(chat_id) + "/data/imagecolor.txt", "w").write("yellow")
- open(str(chat_id) + "/data/textcolor.txt", "w").write("black")
- bot.sendMessage(chat_id, "Color set to yellow.")
- elif "gold" in message:
- open(str(chat_id) + "/data/imagecolor.txt", "w").write("yellow")
- open(str(chat_id) + "/data/textcolor.txt", "w").write("black")
- bot.sendMessage(chat_id, "Color set to gold.")
- elif "pink" in message:
- open(str(chat_id) + "/data/imagecolor.txt", "w").write("pink")
- open(str(chat_id) + "/data/textcolor.txt", "w").write("black")
- bot.sendMessage(chat_id, "Color set to pink.")
- elif "purple" in message:
- open(str(chat_id) + "/data/imagecolor.txt", "w").write("purple")
- open(str(chat_id) + "/data/textcolor.txt", "w").write("white")
- bot.sendMessage(chat_id, "Color set to purple.")
- if "/colour" in message:
- if "green" in message:
- open(str(chat_id) + "/data/imagecolor.txt", "w").write("green")
- open(str(chat_id) + "/data/textcolor.txt", "w").write("black")
- bot.sendMessage(chat_id, "Colour set to green.")
- elif "red" in message:
- open(str(chat_id) + "/data/imagecolor.txt", "w").write("red")
- open(str(chat_id) + "/data/textcolor.txt", "w").write("black")
- bot.sendMessage(chat_id, "Colour set to red.")
- elif "blue" in message:
- open(str(chat_id) + "/data/imagecolor.txt", "w").write("blue")
- open(str(chat_id) + "/data/textcolor.txt", "w").write("black")
- bot.sendMessage(chat_id, "Colour set to blue.")
- elif "black" in message:
- open(str(chat_id) + "/data/imagecolor.txt", "w").write("black")
- open(str(chat_id) + "/data/textcolor.txt", "w").write("white")
- bot.sendMessage(chat_id, "Colour set to black.")
- elif "white" in message:
- open(str(chat_id) + "/data/imagecolor.txt", "w").write("white")
- open(str(chat_id) + "/data/textcolor.txt", "w").write("black")
- bot.sendMessage(chat_id, "Colour set to white.")
- elif "orange" in message:
- open(str(chat_id) + "/data/imagecolor.txt", "w").write("orange")
- open(str(chat_id) + "/data/textcolor.txt", "w").write("black")
- bot.sendMessage(chat_id, "Colour set to orange.")
- elif "yellow" in message:
- open(str(chat_id) + "/data/imagecolor.txt", "w").write("yellow")
- open(str(chat_id) + "/data/textcolor.txt", "w").write("black")
- bot.sendMessage(chat_id, "Colour set to yellow.")
- elif "gold" in message:
- open(str(chat_id) + "/data/imagecolor.txt", "w").write("yellow")
- open(str(chat_id) + "/data/textcolor.txt", "w").write("black")
- bot.sendMessage(chat_id, "Colour set to gold.")
- elif "pink" in message:
- open(str(chat_id) + "/data/imagecolor.txt", "w").write("pink")
- open(str(chat_id) + "/data/textcolor.txt", "w").write("black")
- bot.sendMessage(chat_id, "Colour set to pink.")
- elif "purple" in message:
- open(str(chat_id) + "/data/imagecolor.txt", "w").write("purple")
- open(str(chat_id) + "/data/textcolor.txt", "w").write("white")
- bot.sendMessage(chat_id, "Colour set to purple.")
- if "/addcom " in message:
- if os.path.isfile(str(chat_id) + "/data/c" + str(message[8:]) + ".txt") == False:
- if "/" in message[8:]:
- command = message[8:].replace("/", "slas12")
- else:
- command = message[8:]
- open(str(chat_id) + "/data/c" + str(command).split("::")[0] + ".txt", "w").write("")
- open(str(chat_id) + "/data/commandlist.txt", "a").write(str(command) + "\n")
- open(str(chat_id) + "/data/c" + str(command).split("::")[0] + ".txt", "w").write(str(message[8:]).split("::")[1])
- bot.sendMessage(chat_id, "Command added.")
- else:
- bot.sendMessage(chat_id, "This command is already added.")
- if "/delcom " in message:
- if os.path.isfile(str(chat_id) + "/data/c" + str(message[8:]).replace("/", "slas12") + ".txt") == True:
- os.remove(str(chat_id) + "/data/c" + str(message[8:]).replace("/", "slas12") + ".txt")
- with open(str(chat_id) + "/data/commandlist.txt", "r+") as f:
- t = f.read()
- f.seek(0)
- for line in t.split('\n'):
- if line != str(str(message[8:]).replace("/", "slas12").lower()):
- f.write(line + '\n')
- f.truncate()
- bot.sendMessage(chat_id, "Command deleted.")
- else:
- bot.sendMessage(chat_id, "This command is not added.")
- if "/time " in message:
- if re.search('[a-zA-Z]', message[6:]):
- bot.sendMessage(chat_id, "The time limit can not be a letter.")
- else:
- open(str(chat_id) + "/data/gamelimit.txt", "w").write(message[6:])
- bot.sendMessage(chat_id, "Game time limit set to " + message[6:] + " second(s)")
- if "/admincom" in message:
- bot.sendMessage(chat_id, "Admin Commands:\n/greet (change greet type)\n/time (for games)\n/promote and /demote\n/ban and /unban\n/kick\n/addcom and /delcom (add custom commands)\n/mute and /unmute\n/byebot (Makes the bot leave the group)\n/photo\n/wel (Toggles welcome message)\n/eb (Toggles 8ball)\n/jt (Toggles jokes)\n/rt (Toggles rolling)\n/gt (Toggles games)\n/reset (Removes warns)\n/end (Ends current game)\n/toggles (Shows whats on and off, some are fillers)\n/time (Set's game time limit)")
- if "/end" in message:
- bot.sendMessage(chat_id, str(msg['from']['first_name']) + " reset the game. The word was " + open(
- str(chat_id) + "/data/word.txt", "r").read())
- open(str(chat_id) + "/data/scramble.txt", "w").write("False")
- def dell():
- print(messageID)
- if 'reply_to_message' in msg:
- telegram.Bot.deleteMessage(self=Bot, chat_id=chat_id,
- message_id=msg['reply_to_message']['message_id'])
- telegram.Bot.deleteMessage(self=Bot, chat_id=chat_id, message_id=messageID)
- else:
- telegram.Bot.deleteMessage(self=Bot, chat_id=chat_id, message_id=messageID)
- if message.startswith("/del"):
- if message.startswith("/delcom"):
- ()
- else:
- t = threading.Thread(target=dell)
- t.start()
- if bot.getChatMember(chat_id, messageFromID) in bot.getChatAdministrators(chat_id):
- if "/promote" in message:
- if msg['reply_to_message']['from']['id'] == 353129131:
- bot.sendMessage(chat_id, "Uhh I don't need to be admin of myself lol")
- else:
- if bot.getChatMember(chat_id,
- msg['reply_to_message']['from']['id']) in bot.getChatAdministrators(
- chat_id):
- bot.sendMessage(chat_id,
- "You're admin of the group, you already have access to my commands.")
- else:
- if str(msg['reply_to_message']['from']['id']) in open(str(chat_id) + "/data/admin.txt").read():
- bot.sendMessage(chat_id, "This user is already an admin. To demote, type /demote")
- else:
- open(str(chat_id) + "/data/admin.txt", "a").write(str(msg['reply_to_message']['from']['id']) + "\n")
- bot.sendMessage(chat_id, str(msg['reply_to_message']['from']['first_name']) + " has been promoted")
- if "/demote" in message:
- print(str(chat_id) + '/data/admin.txt')
- if str(msg['reply_to_message']['from']['id']) in open(str(chat_id) + "/data/admin.txt").read():
- with open(str(chat_id) + "/data/admin.txt", "r+") as f:
- t = f.read()
- f.seek(0)
- for line in t.split('\n'):
- if line != str(msg['reply_to_message']['from']['id']):
- f.write(line + '\n')
- f.truncate()
- bot.sendMessage(chat_id, "This user has been demoted.")
- else:
- bot.sendMessage(chat_id, "This user isn't promoted.")
- if "/ban" in message:
- if bot.getChatMember(chat_id, 353129131) in bot.getChatAdministrators(chat_id):
- if bot.getChatMember(chat_id,
- msg['reply_to_message']['from']['id']) in bot.getChatAdministrators(
- chat_id):
- bot.sendMessage(chat_id, "I can't ban admins. Sorry!")
- else:
- bot.sendMessage(chat_id, msg['reply_to_message']['from']['first_name'] + " has been banned by " +
- msg['from']['first_name'] + ".")
- open(str(chat_id) + "/data/unban.txt", "w").write(
- str(msg['reply_to_message']['from']['id']))
- global banned
- bot.kickChatMember(chat_id, msg['reply_to_message']['from']['id'])
- else:
- bot.sendMessage(chat_id, "Error: I need to be admin.")
- if "/mute" in message:
- bot.restrictChatMember(chat_id, msg['reply_to_message']['from']['id'], can_send_messages=False,
- can_add_web_page_previews=False, can_send_media_messages=False,
- can_send_other_messages=False)
- bot.sendMessage(chat_id, "This user has been muted.")
- if "/unmute" in message:
- bot.restrictChatMember(chat_id, msg['reply_to_message']['from']['id'], can_send_messages=True,
- can_add_web_page_previews=True, can_send_media_messages=True,
- can_send_other_messages=True)
- bot.sendMessage(chat_id, "This user has been unmuted.")
- if "/unban" in message:
- if bot.getChatMember(chat_id, 353129131) in bot.getChatAdministrators(chat_id):
- if bot.getChatMember(chat_id,
- msg['reply_to_message']['from']['id']) in bot.getChatAdministrators(
- chat_id):
- bot.sendMessage(chat_id, "I can't ban admins. Sorry!")
- else:
- bot.sendMessage(chat_id, "User has been unbanned")
- open(str(chat_id) + "/data/unban.txt", "w").write(
- str(msg['reply_to_message']['from']['id']))
- global banned
- bot.unbanChatMember(chat_id, msg['reply_to_message']['from']['id'])
- else:
- bot.sendMessage(chat_id, "Error: I need to be admin.")
- if "/kick" in message:
- if bot.getChatMember(chat_id, 353129131) in bot.getChatAdministrators(chat_id):
- if bot.getChatMember(chat_id,
- msg['reply_to_message']['from']['id']) in bot.getChatAdministrators(
- chat_id):
- bot.sendMessage(chat_id, "I can't kick admins. Sorry!")
- else:
- bot.sendMessage(chat_id,
- msg['reply_to_message']['from']['first_name'] + " has been kicked by " +
- msg['from'][
- 'first_name'] + ".")
- bot.kickChatMember(chat_id, msg['reply_to_message']['from']['id'])
- bot.unbanChatMember(chat_id, msg['reply_to_message']['from']['id'])
- else:
- bot.sendMessage(chat_id, "Error: I need to be admin.")
- if isPrivateMessage == False:
- if message.startswith("/title"):
- try:
- bot.setChatTitle(chat_id, str(msg['text'][7:]))
- except:
- bot.sendMessage(chat_id, "An error has occurred")
- if "/byebot" in message:
- bot.sendMessage(chat_id, "Bye! If you had any issues, contact @spoon. Thanks!")
- bot.leaveChat(chat_id)
- else:
- bot.sendMessage(chat_id, "Sorry.. I will leave you alone :( PM whenever")
- if isPrivateMessage == False:
- if "/warn" in message:
- if bot.getChatMember(chat_id, 353129131) in bot.getChatAdministrators(chat_id):
- if bot.getChatMember(chat_id,
- msg['reply_to_message']['from']['id']) in bot.getChatAdministrators(
- chat_id):
- bot.sendMessage(chat_id, "Admins can not get warned.")
- else:
- if os.path.isfile(str(chat_id) + "/data/" + str(
- msg['reply_to_message']['from']['id']) + ".txt") == False:
- filet = open(str(chat_id) + "/data/" + str(msg['reply_to_message']['from']['id']) + ".txt", "w")
- filew = open(str(chat_id) + "/data/" + str(msg['reply_to_message']['from']['id']) + ".txt")
- filer = open(str(chat_id) + "/data/" + str(msg['reply_to_message']['from']['id']) + ".txt", "r")
- filee = open(str(chat_id) + "/data/" + str(msg['reply_to_message']['from']['id']) + ".txt", "r+")
- filet.write("1")
- bot.sendMessage(chat_id, "You have been warned by " + str(msg['from']['first_name']) + " *(1/3)*", parse_mode="markdown")
- open("data/temp.txt", "w").write(str(msg['reply_to_message']['from']['id']))
- global warnd
- else:
- if "1" in open(str(chat_id) + "/data/" + str(msg['reply_to_message']['from']['id']) + ".txt", "r"):
- open(str(chat_id) + "/data/" + str(msg['reply_to_message']['from']['id']) + ".txt", "w").write(
- "2")
- bot.sendMessage(chat_id, "You have been warned by " + str(
- msg['from']['first_name']) + " *(2/3)*", parse_mode="markdown")
- open(str(chat_id) + "/data/temp.txt", "w").write(str(msg['reply_to_message']['from']['id']))
- elif "2" in open(str(chat_id) + "/data/" + str(msg['reply_to_message']['from']['id']) + ".txt",
- "r"):
- open(str(chat_id) + "/data/" + str(msg['reply_to_message']['from']['id']) + ".txt", "w").write(
- "3")
- bot.sendMessage(chat_id, "You exceeded warn limit, you are now banned. *(3/3)*",
- parse_mode="markdown")
- bot.kickChatMember(chat_id, msg['reply_to_message']['from']['id'])
- os.remove(str(chat_id) + "/data/" + str(msg['reply_to_message']['from']['id']) + ".txt")
- open(str(chat_id) + "/data/temp.txt", "w").write(str(msg['reply_to_message']['from']['id']))
- else:
- bot.sendMessage(chat_id, "Don't forget to admin me!")
- if "/photo" in message:
- if "True" in open(str(chat_id) + "/data/photo.txt", "r"):
- open(str(chat_id) + "/data/photo.txt", "w").write("False")
- bot.sendMessage(chat_id, "I will no longer edit photos")
- else:
- open(str(chat_id) + "/data/photo.txt", "w").write("True")
- bot.sendMessage(chat_id, "I will now edit photos")
- if "/wel " in message:
- if "Photo" in open(str(chat_id) + "/data/greet.txt", "r"):
- if len(msg['text'][5:]) > 15:
- bot.sendMessage(chat_id, "This message is too long for a picture message, please try again. Or switch to text by typing /greet")
- else:
- open(str(chat_id) + "/data/greettext.txt", "w").write(msg['text'][5:])
- bot.sendMessage(chat_id, "Welcome message set!")
- else:
- if "True" in open(str(chat_id) + "/wel.txt").read():
- open(str(chat_id) + "/welcome.txt", "w").write(msg['text'][5:])
- bot.sendMessage(chat_id, "Welcome message set!")
- else:
- bot.sendMessage(chat_id, "Welcome messages have been disabled. To re-enable them, type /wt")
- if "/pin" in message:
- if 'reply_to_message' in msg:
- bot.pinChatMessage(chat_id, msg['reply_to_message']['message_id'],
- disable_notification=True)
- telegram.Bot.deleteMessage(self=Bot, chat_id=chat_id, message_id=messageID)
- else:
- bot.sendMessage(chat_id, "Reply to message.")
- if "/wt" in message:
- if "True" in open(str(chat_id) + "/wel.txt", "r"):
- open(str(chat_id) + "/wel.txt", "w").write("False")
- bot.sendMessage(chat_id, "Welcome messages have been disabled.")
- else:
- open(str(chat_id) + "/wel.txt", "w").write("True")
- bot.sendMessage(chat_id, "Welcome messages have been enabled.")
- if "/gt" in message:
- if "True" in open(str(chat_id) + "/data/games.txt", "r"):
- open(str(chat_id) + "/data/games.txt", "w").write("False")
- bot.sendMessage(chat_id, "Games have been disabled.")
- else:
- open(str(chat_id) + "/data/games.txt", "w").write("True")
- bot.sendMessage(chat_id, "Games have been enabled.")
- if "/rt" in message:
- if "True" in open(str(chat_id) + "/data/roll.txt", "r"):
- open(str(chat_id) + "/data/roll.txt", "w").write("False")
- bot.sendMessage(chat_id, "I will no longer roll dice.")
- else:
- open(str(chat_id) + "/data/roll.txt", "w").write("True")
- bot.sendMessage(chat_id, "I will now roll dice.")
- if "/jt" in message:
- if "True" in open(str(chat_id) + "/data/jokes.txt", "r"):
- open(str(chat_id) + "/data/jokes.txt", "w").write("False")
- bot.sendMessage(chat_id, "I will no longer tell jokes.")
- else:
- open(str(chat_id) + "/data/jokes.txt", "w").write("True")
- bot.sendMessage(chat_id, "I will now tell jokes.")
- if "/eb" in message:
- if "True" in open(str(chat_id) + "/data/8ball.txt", "r"):
- open(str(chat_id) + "/data/8ball.txt", "w").write("False")
- bot.sendMessage(chat_id, "I will no longer answer questions.")
- else:
- open(str(chat_id) + "/data/8ball.txt", "w").write("True")
- bot.sendMessage(chat_id, "I will no answer questions.")
- if "/greet" in message:
- if "Text" in open(str(chat_id) + "/data/greet.txt", "r"):
- open(str(chat_id) + "/data/greet.txt", "w").write("Photo")
- bot.sendMessage(chat_id, "I will now greet with photo.")
- else:
- open(str(chat_id) + "/data/greet.txt", "w").write("Text")
- bot.sendMessage(chat_id, "I will now greet with text.")
- if message == "/wel":
- if "True" in open(str(chat_id) + "/wel.txt").read():
- bot.sendMessage(chat_id,"To set a message, type '/wel Welcome message.'\n$u = Username\n$n = User's name\n$t = Title")
- else:
- bot.sendMessage(chat_id, "Welcome messages have been disabled. To re-enable them, type /wt")
- if "/reset" in message:
- if bot.getChatMember(chat_id, 353129131) in bot.getChatAdministrators(chat_id):
- if os.path.isfile(str(chat_id) + "/data/" + str(
- msg['reply_to_message']['from']['id']) + ".txt") == True:
- os.remove(str(chat_id) + "/data/" + str(msg['reply_to_message']['from']['id']) + ".txt")
- bot.sendMessage(chat_id, "Poof! All warns have been removed.")
- else:
- bot.sendMessage(chat_id, "This user has no warns.")
- if "/toggles" in message:
- t = threading.Thread(target=toggle)
- t.start()
- if "/give " in message:
- if "reply_to_message" in msg:
- if msg['reply_to_message']['from']['id'] != messageFromID:
- if "-" in message[6:]:
- bot.sendMessage(chat_id, "lol nice try")
- else:
- if re.search('[a-zA-Z]', message[6:]):
- bot.sendMessage(chat_id, "Can't send letters?")
- print(
- str(open("rooms/" + str(messageFromID) + "money.txt", "r").readlines()).replace("[",
- "").replace(
- "'", "").replace("]", ""))
- else:
- if int(str(open("rooms/" + str(messageFromID) + "money.txt", "r").readlines()).replace(
- "[",
- "").replace(
- "'", "").replace("]", "")) == int(str(msg['text'][6:])):
- minus = int(
- str(open("rooms/" + str(messageFromID) + "money.txt", "r").readlines()).replace(
- "[",
- "").replace(
- "'", "").replace("]", "")) - int(str(msg['text'][6:]))
- add = int(
- str(open("rooms/" + str(msg['reply_to_message']['from']['id']) + "money.txt",
- "r").readlines()).replace("[", "").replace(
- "'", "").replace("]", "")) + int(message[6:])
- open("rooms/" + str(messageFromID) + "money.txt", "w").write("0")
- open("rooms/" + str(msg['reply_to_message']['from']['id']) + "money.txt",
- "w").write(
- str(add))
- bot.sendMessage(chat_id, "Sent *" + str(msg['text'][6:]) + "* coins!",
- parse_mode="markdown")
- elif int(str(open("rooms/" + str(messageFromID) + "money.txt", "r").readlines()).replace(
- "[",
- "").replace(
- "'", "").replace("]", "")) > int(str(msg['text'][6:])):
- minus = int(
- str(open("rooms/" + str(messageFromID) + "money.txt", "r").readlines()).replace(
- "[",
- "").replace(
- "'", "").replace("]", "")) - int(str(msg['text'][6:]))
- add = int(
- str(open("rooms/" + str(msg['reply_to_message']['from']['id']) + "money.txt",
- "r").readlines()).replace("[", "").replace(
- "'", "").replace("]", "")) + int(message[6:])
- open("rooms/" + str(messageFromID) + "money.txt", "w").write(str(minus))
- open("rooms/" + str(msg['reply_to_message']['from']['id']) + "money.txt",
- "w").write(
- str(add))
- bot.sendMessage(chat_id, "Sent *" + str(msg['text'][6:]) + "* coins!",
- parse_mode="markdown")
- else:
- bot.sendMessage(chat_id, "You don't have enough money.")
- else:
- bot.sendMessage(chat_id, "lol nice try")
- if "/jokes" in message:
- if "True" in open(str(chat_id) + "/data/jokes.txt", "r"):
- bot.sendMessage(chat_id, random.choice(jokes))
- def define():
- heart = u'\u2764'
- term = msg['text'][4:]
- if term == "spoon":
- bot.sendMessage(chat_id, "The creator of this bot @spoon" + heart)
- elif term == "panda":
- bot.sendMessage(chat_id,
- "*Panda:*\n\nPanda is an emotional crybaby but she is also heartless and has _no_ feelings. Other than that, she is a good friend to people who deserve it.",
- parse_mode="markdown")
- elif term == "ella":
- bot.sendMessage(chat_id,
- "*Ella:*\n\nElla is very unpredictable. She is the sweetest meanest person you'll ever meet. Sometimes she does things she can't even understand herself, but she isn't stupid. She can also be a harsh and ruthless mean bitch if she wants to, but naturally she is sweet to all.",
- parse_mode="markdown")
- elif term == "awais":
- bot.sendMessage(chat_id,
- "*Awais:*\n\nOne word. Telegod.",
- parse_mode="markdown")
- else:
- term = message.lower()[4:]
- definition = urbandict.define(term)[0]['def']
- bot.sendMessage(chat_id, "*" + term + "*:\n\n" + definition, parse_mode="markdown")
- if "/ud " in message:
- t = threading.Thread(target=define)
- term = msg['text'][4:]
- t.start()
- slapr = ['$q was split from crotch to sternum by $w.', "$q was busted.", "$q was sawn in half by $w.", "$q fell out of the world.", "$q was killed by $w using magic.", "$q fell off a ladder.", "$q withered away.", "$w put $q in check-mate.", "$q played hot-potato with a grenade.", "$q was axe-murdered by $w", "$q was squashed by a falling anvil.", "$q has encountered an error", "$w slapped $q with pure nothing", "$q escaped infection by dying.", "$q suffocated in a wall.", "$q was terminated by $w.", "$q was not invincible.", "$q got finished off by $w", "$q fell from a high place because of $w.", "$q was knocked into the void by $w", "$w threw $q off a building."]
- slap = ['$q was split from crotch to sternum.', "$q was busted.", "$q was sawn in half.", "$q fell out of the world.", "$q was killed by magic.", "$q fell off a ladder.", "$q withered away.", "$q was put in check-mate.", "$q played hot-potato with a grenade.", "$q was axe-murdered", "$q was squashed by a falling anvil.", "$q has encountered an error", "$q was slapped with pure nothing", "$q escaped infection by dying.", "$q suffocated in a wall.", "$q was terminated", "$q was not invincible.", "$q got finished off", "$q fell from a high place", "$q was knocked into the void", "$q was thrown off a building."]
- if "/google " in message:
- google = msg['text'][8:]
- bot.sendMessage(chat_id, "[" + str(google) + "](https://www.google.com/#q=" + str(google).replace(" ",
- "+") + ")",
- parse_mode="markdown", disable_web_page_preview=True)
- if "/slap" in message:
- if "reply_to_message" in msg:
- if os.path.isfile("data/n" + str(messageFromID) + ".txt") == False:
- name = str(msg['from']['first_name'])
- else:
- name = str(open("data/n" + str(messageFromID) + ".txt").read())
- if os.path.isfile("data/n" + str(msg['reply_to_message']['from']['id']) + ".txt") == False:
- namer = str(msg['reply_to_message']['from']['first_name'])
- else:
- namer = str(open("data/n" + str(msg['reply_to_message']['from']['id']) + ".txt").read())
- bot.sendMessage(chat_id, str(random.choice(slapr)).replace("$q", namer).replace("$w", name), reply_to_message_id=msg['message_id'])
- else:
- if os.path.isfile("data/n" + str(messageFromID) + ".txt") == False:
- name = str(msg['from']['first_name'])
- else:
- name = str(open("data/n" + str(messageFromID) + ".txt").read())
- bot.sendMessage(chat_id, str(random.choice(slap)).replace("$q", name), reply_to_message_id=msg['message_id'])
- if message == '/def':
- bot.sendMessage(chat_id, "Usage: /def <term>")
- if messageType != 'private':
- if "/scramble" in message:
- if "True" in open(str(chat_id) + "/data/games.txt", "r").read():
- if "False" in open(str(chat_id) + "/data/scramble.txt", "r").read():
- open(str(chat_id) + "/data/scramble.txt", "w").write('True')
- else:
- bot.sendMessage(chat_id, "Game in progress!!")
- def scramble():
- open(str(chat_id) + "/data/scramble.txt", "w").write('inprogress')
- rw = RandomWords()
- word = rw.random_word()
- open(str(chat_id) + "/data/word.txt", "w").write(str(word))
- global word
- words = ''.join(random.sample(word, len(word)))
- bot.sendMessage(chat_id, "The word to unscramble is:\n*" + str(words) + "*", parse_mode="markdown")
- print(word)
- endTime = datetime.datetime.now() + datetime.timedelta(seconds=int(open(str(chat_id) + "/data/gamelimit.txt").read()))
- while True:
- if "inprogress" in open(str(chat_id) + "/data/scramble.txt", "r").read():
- if datetime.datetime.now() >= endTime:
- bot.sendMessage(chat_id, "Times up word is *" + str(word) + "*", parse_mode="markdown")
- open(str(chat_id) + "/data/scramble.txt", "w").write('False')
- break
- else:
- break
- if messageType != 'private':
- if "True" in open(str(chat_id) + "/data/scramble.txt", "r").read():
- t = threading.Thread(target=scramble)
- t.start()
- if "inprogress" in open(str(chat_id) + "/data/scramble.txt", "r").read():
- if open(str(chat_id) + "/data/word.txt").read() in message:
- write = int(
- str(open("rooms/" + str(messageFromID) + "money.txt", "r").readlines()).replace("[",
- "").replace(
- "'", "").replace("]", "")) + int(len(word) * 20)
- write2 = int(
- str(open("rooms/" + str(messageFromID) + "wins.txt", "r").readlines()).replace("[",
- "").replace(
- "'", "").replace("]", "")) + int(1)
- bot.sendMessage(chat_id, str(msg['from']['first_name']) + " wins!")
- open("rooms/" + str(messageFromID) + "wins.txt", "w").write(str(write2))
- open(str(chat_id) + "/data/scramble.txt", "w").write('False')
- open("rooms/" + str(messageFromID) + "money.txt", "w").write(str(write))
- if message in commandsList:
- if message in message:
- cont = True
- if cont:
- if message == "hey bot":
- if os.path.isfile("data/n" + str(messageFromID) + ".txt") == False:
- bot.sendMessage(chat_id, "Hi, " + msg['from']['first_name'][:15] + "!")
- else:
- bot.sendMessage(chat_id, "Hi, " + open("data/n" + str(messageFromID) + ".txt").read() + "!")
- def picturemessage():
- Bot.send_chat_action(chat_id, action=telegram.ChatAction.TYPING)
- try:
- color = open(str(chat_id) + "/data/imagecolor.txt").read()
- color1 = open(str(chat_id) + "/data/textcolor.txt").read()
- profiles = bot.getUserProfilePhotos(msg['new_chat_member']['id'])
- file_id = profiles['photos'][0][2]['file_id']
- filename = str(msg['new_chat_member']['id']) + ".jpg"
- bot.download_file(file_id, filename)
- im = Image.open(filename)
- img = PIL.Image.new("RGB", (640, 800), (color))
- draw = PIL.ImageDraw.Draw(img)
- font = ImageFont.truetype("DejaVuSans.ttf", int("65"))
- except:
- filename = "NoPFP.jpg"
- im = Image.open(filename)
- img = Image.new("RGB", (640, 800), (color))
- draw = PIL.ImageDraw.Draw(img)
- font = ImageFont.truetype("DejaVuSans.ttf", int("65"))
- if os.path.isfile("data/n" + str(msg["new_chat_member"]['id']) + ".txt") == False:
- if len(msg['from']['first_name']) > 15:
- line2 = msg["new_chat_member"]['first_name'][:15] + "...!"
- else:
- line2 = msg['new_chat_member']['first_name'] + "!"
- else:
- if len(open("data/n" + str(msg["new_chat_member"]['id']) + ".txt").read()) > 15:
- line2 = open("data/n" + str(msg["new_chat_member"]['id']) + ".txt").read()[:15] + "...!"
- else:
- line2 = open("data/n" + str(msg["new_chat_member"]['id']) + ".txt").read() + "!"
- if os.path.isfile(str(chat_id) + "/data/greettext.txt") == False:
- line1 = "Welcome"
- else:
- line1 = str(open(str(chat_id) + "/data/greettext.txt").read())
- w, h = font.getsize(line1)
- w2, h2 = font.getsize(line2)
- draw.text(((650 - w) / 2, (1360 - h) / 2), line1, font=font, fill=str(color1))
- draw.text(((650 - w2) / 2, ((1300 - h2) / 2) + 100), line2, font=font, fill=str(color1))
- img.paste(im, (0, 0))
- img.save("1" + filename)
- bot.sendPhoto(chat_id, open("1" + filename, "rb"))
- os.remove("1" + filename)
- if filename != "NoPFP.jpg":
- os.remove(filename)
- if 'new_chat_member' in msg:
- if 'username' in msg:
- newuser = str("@" + msg['new_chat_member']['username'])
- else:
- newuser = msg['from']['first_name']
- if 'new_chat_member' in msg:
- newuser = msg['new_chat_member']['first_name']
- print(msg['new_chat_member']['first_name'], "has joined", msg['chat']['title'])
- if msg['new_chat_member']['id'] == 353129131:
- bot.sendMessage(chat_id, "Hi, I am currently in beta. So if there are any bugs, PM @spoon xoxo")
- else:
- if 'True' in open(str(chat_id) + "/wel.txt").read():
- if "Text" in open(str(chat_id) + "/data/greet.txt").read():
- if os.path.isfile(str(chat_id) + "/welcome.txt") == False:
- bot.sendMessage(chat_id,
- "Welcome to the group! The welcome message has not been set. Type '/wel' and then your message. For more help, type /wel")
- else:
- if os.path.isfile("data/n" + str(msg['new_chat_member']['id']) + ".txt") == False:
- f = open(str(chat_id) + "/welcome.txt").read().replace("$n",
- msg['new_chat_member'][
- 'first_name']).replace(
- "$u",
- newuser).replace("$t", msg['chat']['title'])
- bot.sendMessage(chat_id, str(f))
- else:
- f = open(str(chat_id) + "/welcome.txt").read().replace("$n",
- open("data/n" + str(
- msg['new_chat_member']['id']) + ".txt").read()).replace(
- "$u",
- newuser).replace("$t", msg['chat']['title'])
- bot.sendMessage(chat_id, str(f))
- else:
- t = threading.Thread(target=picturemessage)
- t.start()
- def check():
- if messageType != 'private':
- if bot.getChatMember(chat_id, messageFromID) in bot.getChatAdministrators(chat_id):
- t = threading.Thread(target=admincom)
- t.start()
- else:
- if str(messageFromID) in open(str(chat_id) + "/data/admin.txt", "r").read():
- t = threading.Thread(target=admincom)
- t.start()
- if messageType != 'private':
- t = threading.Thread(target=check)
- t.start()
- if "/callme " in message:
- if len(message[8:]) > 25:
- bot.sendMessage(chat_id, "The limit is 25 characters!")
- elif "nothing" in message:
- if os.path.isfile("data/n" + str(messageFromID) + ".txt") == False:
- bot.sendMessage(chat_id, "You currently have no nicknames, and I won't call you nothing :(")
- else:
- bot.sendMessage(chat_id, "Okay, I won't call you by any nicknames.")
- os.remove("data/n" + str(messageFromID) + ".txt")
- else:
- if u"\u2B50" in message:
- bot.sendMessage(chat_id, "You are trying to put a restricted emoji your name. This star is only for admins, please retry.")
- else:
- bot.sendMessage(chat_id, "Okay " + msg['text'][8:].replace(u"\u2B50", "") + ", I'll remember that.")
- open("data/n" + str(messageFromID) + ".txt", "w").write(str(msg['text'][8:]).replace(u"\u2B50", ""))
- if "/check" in message:
- if messageType != 'private':
- if 'reply_to_message' in msg:
- if bot.getChatMember(chat_id, msg['reply_to_message']['from']['id']) in bot.getChatAdministrators(
- chat_id):
- star = u"\u2B50"
- else:
- if str(msg['reply_to_message']['from']['id']) in open(str(chat_id) + "/data/admin.txt").read():
- star = u"\u2B50"
- else:
- star = ""
- if os.path.isfile("data/n" + str(msg['reply_to_message']['from']['id']) + ".txt") == True:
- name = open("data/n" + str(msg['reply_to_message']['from']['id']) + ".txt").read()
- else:
- msg['from']['first_name'][:15]
- if os.path.isfile(str(chat_id) + "/data/" + str(msg['reply_to_message']['from']['id']) + ".txt") == True:
- Warns = str("Amount of warns: *(" + str(
- open(str(chat_id) + "/data/" + str(msg['reply_to_message']['from']['id']) + ".txt",
- "r").read()) + "/3)*\n")
- else:
- Warns = ""
- if os.path.isfile("data/n" + str(msg['reply_to_message']['from']['id']) + ".txt") == False:
- if " help" in message:
- bot.sendMessage(chat_id,
- "You can add links to your /check message by sending this:\n/check instagram <instagram username>\n/check reddit <reddit username>\n/check steam <steam username>\n/check location <location>\n/check snapchat <snapchat>\n/check soundcloud <soundcloud>")
- if os.path.isfile(
- ("data/insta" + str(msg['reply_to_message']['from']['id']) + ".txt")) == True:
- Instagram = str("Instagram: [" + str(
- open("data/insta" + str(msg['reply_to_message']['from']['id']) + ".txt",
- "r").read()) + "](https://www.instagram.com/" + str(
- open("data/insta" + str(msg['reply_to_message']['from']['id']) + ".txt",
- "r").read()) + ")\n")
- else:
- Instagram = ""
- if os.path.isfile(
- ("data/steam" + str(msg['reply_to_message']['from']['id']) + ".txt")) == True:
- Steam = str("Steam: [" + str(
- open("data/steam" + str(msg['reply_to_message']['from']['id']) + ".txt",
- "r").read()) + "](http://steamcommunity.com/id/" + str(
- open("data/steam" + str(msg['reply_to_message']['from']['id']) + ".txt",
- "r").read()) + ")\n")
- else:
- Steam = ""
- if os.path.isfile(
- ("data/soundcloud" + str(msg['reply_to_message']['from']['id']) + ".txt")) == True:
- Soundcloud = str("Soundcloud: [" + str(
- open("data/soundcloud" + str(msg['reply_to_message']['from']['id']) + ".txt",
- "r").read()) + "](https://soundcloud.com/" + str(
- open("data/soundcloud" + str(msg['reply_to_message']['from']['id']) + ".txt",
- "r").read()) + ")\n")
- else:
- Soundcloud = ""
- if os.path.isfile(
- ("data/red" + str(msg['reply_to_message']['from']['id']) + ".txt")) == True:
- Reddit = str(
- "Reddit: [" + str(
- open("data/red" + str(msg['reply_to_message']['from']['id']) + ".txt",
- "r").read()) + "](https://www.reddit.com/user/" + str(
- open("data/red" + str(msg['reply_to_message']['from']['id']) + ".txt",
- "r").read()) + ")\n")
- else:
- Reddit = ""
- if os.path.isfile(
- ("data/snapchat" + str(msg['reply_to_message']['from']['id']) + ".txt")) == True:
- Snapchat = str("Snapchat: [" + str(
- open("data/snapchat" + str(msg['reply_to_message']['from']['id']) + ".txt",
- "r").read()) + "](https://www.snapchat.com/add/" + str(
- open("data/snapchat" + str(msg['reply_to_message']['from']['id']) + ".txt",
- "r").read()) + ")\n")
- else:
- Snapchat = ""
- if os.path.isfile(
- ("data/loc" + str(msg['reply_to_message']['from']['id']) + ".txt")) == True:
- Location = str("Location: [" + str(
- open("data/loc" + str(msg['reply_to_message']['from']['id']) + ".txt",
- "r").read()) + "](https://www.google.com/#q=" + str(
- open("data/loc" + str(msg['reply_to_message']['from']['id']) + ".txt",
- "r").read()).replace(" ", "+") + ")\n")
- else:
- Location = ""
- usermessages = open(str(chat_id) + "/messages/" + str(msg['reply_to_message']['from']['id']) + ".txt",
- "r").read()
- groupmessages = open(str(chat_id) + "/messagecount.txt", "r").read()
- percentage = round((int(usermessages) / int(groupmessages)) * 100, 2)
- print(percentage)
- if message == "/check":
- bot.sendMessage(chat_id,
- "*" + msg['reply_to_message']['from']['first_name'] + " " + star + "*\n\nCoins: *" + str(
- open("rooms/" + str(msg['reply_to_message']['from']['id']) + "money.txt",
- "r").read()) + "\n*Wins: *" + str(
- open("rooms/" + str(msg['reply_to_message']['from']['id']) + "wins.txt",
- "r").read()) + "*\n%s%s%s%s%s%s%sYou've sent " % (
- Warns,
- Instagram, Reddit, Steam, Location, Soundcloud, Snapchat) + open(
- str(chat_id) +
- "/messages/" + str(msg['reply_to_message']['from']['id']) + ".txt",
- "r").read() + " (" + str(
- percentage) + "%) and this group has " + open(
- str(chat_id) + "/messagecount.txt",
- "r").read() + " messages.",
- parse_mode="markdown", disable_web_page_preview=True)
- else:
- if os.path.isfile(str(chat_id) + "/data/" + str(
- msg['reply_to_message']['from']['id']) + ".txt") == True:
- Warns = str(
- "Amount of warns: *(" + str(
- open(str(chat_id) + "/data/" + str(msg['reply_to_message']['from']['id']) + ".txt",
- "r").read()) + "/3)*\n")
- else:
- Warns = ""
- if " instagram " in message:
- if "delete" in msg['text'][17:].lower():
- os.remove("data/insta" + str(msg['reply_to_message']['from']['id']) + ".txt")
- bot.sendMessage(chat_id, "Instagram removed!")
- else:
- if len(msg['text'][17:].lower()) > 15:
- bot.sendMessage(chat_id, "Not a valid Instagram name.")
- else:
- open("data/insta" + str(msg['reply_to_message']['from']['id']) + ".txt",
- "w").write(
- str(msg['text'][17:]))
- bot.sendMessage(chat_id, "Instagram set!")
- if " reddit " in message:
- if "delete" in msg['text'][14:].lower():
- os.remove("data/red" + str(msg['reply_to_message']['from']['id']) + ".txt")
- bot.sendMessage(chat_id, "Reddit removed!")
- else:
- if len(msg['text'][14:].lower()) > 15:
- bot.sendMessage(chat_id, "Not a valid Reddit name.")
- else:
- open("data/red" + str(msg['reply_to_message']['from']['id']) + ".txt",
- "w").write(
- str(msg['text'][14:]))
- bot.sendMessage(chat_id, "Reddit set!")
- if " help" in message:
- bot.sendMessage(chat_id,
- "You can add links to your /check message by sending this:\n/check instagram <instagram username>\n/check reddit <reddit username>\n/check steam <steam username>\n/check location <location>")
- if " steam " in message:
- if "delete" in msg['text'][13:].lower():
- os.remove("data/steam" + str(msg['reply_to_message']['from']['id']) + ".txt")
- bot.sendMessage(chat_id, "Steam removed!")
- else:
- if len(msg['text'][13:].lower()) > 20:
- bot.sendMessage(chat_id, "Not a valid Steam name.")
- else:
- open("data/steam" + str(msg['reply_to_message']['from']['id']) + ".txt",
- "w").write(
- str(msg['text'][13:]))
- bot.sendMessage(chat_id, "Steam set!")
- if " soundcloud " in message:
- if "delete" in msg['text'][13:].lower():
- os.remove("data/soundcloud" + str(msg['reply_to_message']['from']['id']) + ".txt")
- bot.sendMessage(chat_id, "Steam removed!")
- else:
- if len(msg['text'][18:].lower()) > 20:
- bot.sendMessage(chat_id, "Not a valid Soundcloud name.")
- else:
- open("data/soundcloud" + str(msg['reply_to_message']['from']['id']) + ".txt",
- "w").write(
- str(msg['text'][18:]))
- bot.sendMessage(chat_id, "Soundcloud set!")
- if " location " in message:
- if "delete" in msg['text'].lower():
- os.remove("data/loc" + str(msg['reply_to_message']['from']['id']) + ".txt")
- bot.sendMessage(chat_id, "Location removed!")
- else:
- if len(msg['text'].lower()) > 30:
- bot.sendMessage(chat_id, "Not a valid Location name.")
- else:
- open("data/loc" + str(msg['reply_to_message']['from']['id']) + ".txt",
- "w").write(
- str(msg['text'][15:]))
- bot.sendMessage(chat_id, "Location set!")
- if " snapchat " in message:
- if "delete" in msg['text'][16:].lower():
- os.remove("data/snapchat" + str(msg['reply_to_message']['from']['id']) + ".txt")
- bot.sendMessage(chat_id, "Snapchat removed!")
- else:
- if len(msg['text'][16:].lower()) > 15:
- bot.sendMessage(chat_id, "Not a valid Snapchat name.")
- else:
- open("data/snapchat" + str(msg['reply_to_message']['from']['id']) + ".txt",
- "w").write(
- str(msg['text'][16:]))
- bot.sendMessage(chat_id, "Snapchat set!")
- if os.path.isfile(
- ("data/insta" + str(msg['reply_to_message']['from']['id']) + ".txt")) == True:
- Instagram = str("Instagram: [" + str(
- open("data/insta" + str(msg['reply_to_message']['from']['id']) + ".txt",
- "r").read()) + "](https://www.instagram.com/" + str(
- open("data/insta" + str(msg['reply_to_message']['from']['id']) + ".txt",
- "r").read()) + ")\n")
- else:
- Instagram = ""
- if os.path.isfile(
- ("data/steam" + str(msg['reply_to_message']['from']['id']) + ".txt")) == True:
- Steam = str("Steam: [" + str(
- open("data/steam" + str(msg['reply_to_message']['from']['id']) + ".txt",
- "r").read()) + "](http://steamcommunity.com/id/" + str(
- open("data/steam" + str(msg['reply_to_message']['from']['id']) + ".txt",
- "r").read()) + ")\n")
- else:
- Steam = ""
- if os.path.isfile(
- ("data/soundcloud" + str(msg['reply_to_message']['from']['id']) + ".txt")) == True:
- Soundcloud = str("Soundcloud: [" + str(
- open("data/soundcloud" + str(msg['reply_to_message']['from']['id']) + ".txt",
- "r").read()) + "](https://soundcloud.com/" + str(
- open("data/soundcloud" + str(msg['reply_to_message']['from']['id']) + ".txt",
- "r").read()) + ")\n")
- else:
- Soundcloud = ""
- if os.path.isfile(
- ("data/red" + str(msg['reply_to_message']['from']['id']) + ".txt")) == True:
- Reddit = str(
- "Reddit: [" + str(
- open("data/red" + str(msg['reply_to_message']['from']['id']) + ".txt",
- "r").read()) + "](https://www.reddit.com/user/" + str(
- open("data/red" + str(msg['reply_to_message']['from']['id']) + ".txt",
- "r").read()) + ")\n")
- else:
- Reddit = ""
- if os.path.isfile(
- ("data/snapchat" + str(msg['reply_to_message']['from']['id']) + ".txt")) == True:
- Snapchat = str("Snapchat: [" + str(
- open("data/snapchat" + str(msg['reply_to_message']['from']['id']) + ".txt",
- "r").read()) + "](https://www.snapchat.com/add/" + str(
- open("data/snapchat" + str(msg['reply_to_message']['from']['id']) + ".txt",
- "r").read()) + ")\n")
- else:
- Snapchat = ""
- if os.path.isfile(
- ("data/loc" + str(msg['reply_to_message']['from']['id']) + ".txt")) == True:
- Location = str("Location: [" + str(
- open("data/loc" + str(msg['reply_to_message']['from']['id']) + ".txt",
- "r").read()) + "](https://www.google.com/#q=" + str(
- open("data/loc" + str(msg['reply_to_message']['from']['id']) + ".txt",
- "r").read()).replace(" ", "+") + ")\n")
- else:
- Location = ""
- usermessages = open(str(chat_id) + "/messages/" + str(msg['reply_to_message']['from']['id']) + ".txt",
- "r").read()
- groupmessages = open(str(chat_id) + "/messagecount.txt", "r").read()
- percentage = round((int(usermessages) / int(groupmessages)) * 100, 2)
- print(percentage)
- if message == "/check":
- bot.sendMessage(chat_id, "*" + name + " " + star + "*\n\nCoins: *" + str(
- open("rooms/" + str(msg['reply_to_message']['from']['id']) + "money.txt",
- "r").read()) + "\n*Wins: *" + str(
- open("rooms/" + str(msg['reply_to_message']['from']['id']) + "wins.txt",
- "r").read()) + "*\n%s%s%s%s%s%s%sYou've sent " % (
- Warns,
- Instagram, Reddit, Steam, Location, Soundcloud, Snapchat) + open(
- str(chat_id) +
- "/messages/" + str(msg['reply_to_message']['from']['id']) + ".txt", "r").read() + " (" + str(
- percentage) + "%) and this group has " + open(str(chat_id) + "/messagecount.txt",
- "r").read() + " messages.",
- parse_mode="markdown", disable_web_page_preview=True)
- else:
- if bot.getChatMember(chat_id, messageFromID) in bot.getChatAdministrators(
- chat_id):
- star = u"\u2B50"
- else:
- if str(messageFromID) in open(str(chat_id) + "/data/admin.txt").read():
- star = u"\u2B50"
- else:
- star = ""
- if os.path.isfile("data/n" + str(messageFromID) + ".txt") == False:
- if " help" in message:
- bot.sendMessage(chat_id,
- "You can add links to your /check message by sending this:\n/check instagram <instagram username>\n/check reddit <reddit username>\n/check steam <steam username>\n/check location <location>")
- if " instagram " in message:
- if "delete" in msg['text'][11:].lower():
- os.remove("data/insta" + str(messageFromID) + ".txt")
- bot.sendMessage(chat_id, "Instagram removed!")
- else:
- if len(msg['text'][11:].lower()) > 15:
- bot.sendMessage(chat_id, "Not a valid Instagram name.")
- else:
- open("data/insta" + str(messageFromID) + ".txt", "w").write(
- str(msg['text'][17:]))
- bot.sendMessage(chat_id, "Instagram set!")
- if " reddit " in message:
- if "delete" in msg['text'][11:].lower():
- os.remove("data/red" + str(messageFromID) + ".txt")
- bot.sendMessage(chat_id, "Reddit removed!")
- else:
- if len(msg['text'][11:].lower()) > 15:
- bot.sendMessage(chat_id, "Not a valid Reddit name.")
- else:
- open("data/red" + str(messageFromID) + ".txt", "w").write(
- str(msg['text'][14:]))
- bot.sendMessage(chat_id, "Reddit set!")
- if " steam " in message:
- if "delete" in msg['text'][11:].lower():
- os.remove("data/steam" + str(messageFromID) + ".txt")
- bot.sendMessage(chat_id, "Steam removed!")
- else:
- if len(msg['text'][11:].lower()) > 20:
- bot.sendMessage(chat_id, "Not a valid Steam name.")
- else:
- open("data/steam" + str(messageFromID) + ".txt", "w").write(
- str(msg['text'][13:]))
- bot.sendMessage(chat_id, "Steam set!")
- if " soundcloud " in message:
- if "delete" in msg['text'][13:].lower():
- os.remove("data/soundcloud" + str(messageFromID) + ".txt")
- bot.sendMessage(chat_id, "Steam removed!")
- else:
- if len(msg['text'][18:].lower()) > 20:
- bot.sendMessage(chat_id, "Not a valid Soundcloud name.")
- else:
- open("data/soundcloud" + str(messageFromID) + ".txt", "w").write(
- str(msg['text'][18:]))
- bot.sendMessage(chat_id, "Soundcloud set!")
- if " snapchat " in message:
- if "delete" in msg['text'][16:].lower():
- os.remove("data/snapchat" + str(messageFromID) + ".txt")
- bot.sendMessage(chat_id, "Snapchat removed!")
- else:
- if len(msg['text'][16:].lower()) > 15:
- bot.sendMessage(chat_id, "Not a valid Snapchat name.")
- else:
- open("data/snapchat" + str(messageFromID) + ".txt", "w").write(
- str(msg['text'][16:]))
- bot.sendMessage(chat_id, "Snapchat set!")
- if os.path.isfile(("data/soundcloud" + str(messageFromID) + ".txt")) == True:
- Soundcloud = str("Soundcloud: [" + str(
- open("data/soundcloud" + str(messageFromID) + ".txt",
- "r").read()) + "](https://soundcloud.com/" + str(
- open("data/soundcloud" + str(messageFromID) + ".txt",
- "r").read()) + ")\n")
- else:
- Soundcloud = ""
- if os.path.isfile(("data/snapchat" + str(messageFromID) + ".txt")) == True:
- Snapchat = str("Snapchat: [" + str(
- open("data/snapchat" + str(messageFromID) + ".txt",
- "r").read()) + "](https://www.snapchat.com/add/" + str(
- open("data/snapchat" + str(messageFromID) + ".txt",
- "r").read()) + ")\n")
- else:
- Snapchat = ""
- if " location " in message:
- if "delete" in msg['text'][11:].lower():
- os.remove("data/loc" + str(messageFromID) + ".txt")
- bot.sendMessage(chat_id, "Location removed!")
- else:
- if len(msg['text'][11:].lower()) > 30:
- bot.sendMessage(chat_id, "Not a valid Location name.")
- else:
- open("data/loc" + str(messageFromID) + ".txt", "w").write(
- str(msg['text'][15:]))
- bot.sendMessage(chat_id, "Location set!")
- if os.path.isfile(("data/insta" + str(messageFromID) + ".txt")) == True:
- Instagram = str(
- "Instagram: [" + str(open("data/insta" + str(messageFromID) + ".txt",
- "r").read()) + "](https://www.instagram.com/" + str(
- open("data/insta" + str(messageFromID) + ".txt", "r").read()) + ")\n")
- else:
- Instagram = ""
- if os.path.isfile(("data/steam" + str(messageFromID) + ".txt")) == True:
- Steam = str("Steam: [" + str(open("data/steam" + str(messageFromID) + ".txt",
- "r").read()) + "](http://steamcommunity.com/id/" + str(
- open("data/steam" + str(messageFromID) + ".txt", "r").read()) + ")\n")
- else:
- Steam = ""
- if os.path.isfile(("data/red" + str(messageFromID) + ".txt")) == True:
- Reddit = str("Reddit: [" + str(open("data/red" + str(messageFromID) + ".txt",
- "r").read()) + "](https://www.reddit.com/user/" + str(
- open("data/red" + str(messageFromID) + ".txt", "r").read()) + ")\n")
- else:
- Reddit = ""
- if os.path.isfile(("data/loc" + str(messageFromID) + ".txt")) == True:
- Location = str("Location: [" + str(open("data/loc" + str(messageFromID) + ".txt",
- "r").read()) + "](https://www.google.com/#q=" + str(
- open("data/loc" + str(messageFromID) + ".txt", "r").read()).replace(" ",
- "+") + ")\n")
- else:
- Location = ""
- if os.path.isfile(str(chat_id) + "/data/" + str(messageFromID) + ".txt") == True:
- Warns = str(
- "Amount of warns: *(" + str(open(str(chat_id) + "/data/" + str(messageFromID) + ".txt",
- "r").read()) + "/3)*\n")
- else:
- Warns = ""
- usermessages = open(str(chat_id) + "/messages/" + str(messageFromID) + ".txt", "r").read()
- groupmessages = open(str(chat_id) + "/messagecount.txt", "r").read()
- percentage = round((int(usermessages) / int(groupmessages)) * 100, 2)
- print(percentage)
- if message == "/check":
- bot.sendMessage(chat_id, "*" + msg['from']['first_name'] + " " + star + "*\n\nCoins: *" + str(
- open("rooms/" + str(messageFromID) + "money.txt",
- "r").read()) + "\n*Wins: *" + str(
- open("rooms/" + str(messageFromID) + "wins.txt",
- "r").read()) + "*\n%s%s%s%s%s%s%sYou've sent " % (
- Warns,
- Instagram, Reddit, Steam, Location, Soundcloud, Snapchat) + open(
- str(chat_id) +
- "/messages/" + str(messageFromID) + ".txt", "r").read() + " (" + str(
- percentage) + "%) and this group has " + open(str(chat_id) + "/messagecount.txt",
- "r").read() + " messages.",
- parse_mode="markdown", disable_web_page_preview=True)
- else:
- if bot.getChatMember(chat_id,
- messageFromID) in bot.getChatAdministrators(chat_id):
- star = u"\u2B50"
- else:
- if str(messageFromID) in open(str(chat_id) + "/data/admin.txt").read():
- star = u"\u2B50"
- else:
- star = ""
- if " help" in message:
- bot.sendMessage(chat_id,
- "You can add links to your /check message by sending this:\n/check instagram <instagram username>\n/check snapchat <snapchat username>\n/check soundcloud <soundcloud username>\n/check reddit <reddit username>\n/check steam <steam username>\n/check location <location>")
- if " instagram " in message:
- if "delete" in msg['text'][17:].lower():
- os.remove("data/insta" + str(messageFromID) + ".txt")
- bot.sendMessage(chat_id, "Instagram removed!")
- else:
- if len(msg['text'][17:].lower()) > 15:
- bot.sendMessage(chat_id, "Not a valid Instagram name.")
- else:
- open("data/insta" + str(messageFromID) + ".txt", "w").write(
- str(msg['text'][17:]))
- bot.sendMessage(chat_id, "Instagram set!")
- if " snapchat " in message:
- if "delete" in msg['text'][16:].lower():
- os.remove("data/snapchat" + str(messageFromID) + ".txt")
- bot.sendMessage(chat_id, "Snapchat removed!")
- else:
- if len(msg['text'][16:].lower()) > 15:
- bot.sendMessage(chat_id, "Not a valid Snapchat name.")
- else:
- open("data/snapchat" + str(messageFromID) + ".txt", "w").write(
- str(msg['text'][16:]))
- bot.sendMessage(chat_id, "Snapchat set!")
- if " reddit " in message:
- if "delete" in msg['text'][14:].lower():
- os.remove("data/red" + str(messageFromID) + ".txt")
- bot.sendMessage(chat_id, "Reddit removed!")
- else:
- if len(msg['text'][14:].lower()) > 15:
- bot.sendMessage(chat_id, "Not a valid Reddit name.")
- else:
- open("data/red" + str(messageFromID) + ".txt", "w").write(
- str(msg['text'][14:]))
- bot.sendMessage(chat_id, "Reddit set!")
- if " soundcloud " in message:
- if "delete" in msg['text'][13:].lower():
- os.remove("data/soundcloud" + str(messageFromID) + ".txt")
- bot.sendMessage(chat_id, "Steam removed!")
- else:
- if len(msg['text'][18:].lower()) > 20:
- bot.sendMessage(chat_id, "Not a valid Soundcloud name.")
- else:
- open("data/soundcloud" + str(messageFromID) + ".txt", "w").write(
- str(msg['text'][18:]))
- bot.sendMessage(chat_id, "Soundcloud set!")
- if os.path.isfile(("data/soundcloud" + str(messageFromID) + ".txt")) == True:
- Soundcloud = str("Soundcloud: [" + str(
- open("data/soundcloud" + str(messageFromID) + ".txt",
- "r").read()) + "](https://soundcloud.com/" + str(
- open("data/soundcloud" + str(messageFromID) + ".txt",
- "r").read()) + ")\n")
- else:
- Soundcloud = ""
- if os.path.isfile(("data/snapchat" + str(messageFromID) + ".txt")) == True:
- Snapchat = str("Snapchat: [" + str(
- open("data/snapchat" + str(messageFromID) + ".txt",
- "r").read()) + "](https://www.snapchat.com/add/" + str(
- open("data/snapchat" + str(messageFromID) + ".txt",
- "r").read()) + ")\n")
- else:
- Snapchat = ""
- if " steam " in message:
- if "delete" in msg['text'][13:].lower():
- os.remove("data/steam" + str(messageFromID) + ".txt")
- bot.sendMessage(chat_id, "Steam removed!")
- else:
- if len(msg['text'][13:].lower()) > 20:
- bot.sendMessage(chat_id, "Not a valid Steam name.")
- else:
- open("data/steam" + str(messageFromID) + ".txt", "w").write(
- str(msg['text'][13:]))
- bot.sendMessage(chat_id, "Steam set!")
- if " location " in message:
- if "delete" in msg['text'].lower():
- os.remove("data/loc" + str(messageFromID) + ".txt")
- bot.sendMessage(chat_id, "Location removed!")
- else:
- if len(msg['text'].lower()) > 30:
- bot.sendMessage(chat_id, "Not a valid Location name.")
- else:
- open("data/loc" + str(messageFromID) + ".txt", "w").write(
- str(msg['text'][15:]))
- bot.sendMessage(chat_id, "Location set!")
- if os.path.isfile(("data/insta" + str(messageFromID) + ".txt")) == True:
- Instagram = str(
- "Instagram: [" + str(open("data/insta" + str(messageFromID) + ".txt",
- "r").read()) + "](https://www.instagram.com/" + str(
- open("data/insta" + str(messageFromID) + ".txt", "r").read()) + ")\n")
- else:
- Instagram = ""
- if os.path.isfile(("data/steam" + str(messageFromID) + ".txt")) == True:
- Steam = str("Steam: [" + str(open("data/steam" + str(messageFromID) + ".txt",
- "r").read()) + "](http://steamcommunity.com/id/" + str(
- open("data/steam" + str(messageFromID) + ".txt", "r").read()) + ")\n")
- else:
- Steam = ""
- if os.path.isfile(("data/red" + str(messageFromID) + ".txt")) == True:
- Reddit = str("Reddit: [" + str(open("data/red" + str(messageFromID) + ".txt",
- "r").read()) + "](https://www.reddit.com/user/" + str(
- open("data/red" + str(messageFromID) + ".txt", "r").read()) + ")\n")
- else:
- Reddit = ""
- if os.path.isfile(("data/loc" + str(messageFromID) + ".txt")) == True:
- Location = str("Location: [" + str(open("data/loc" + str(messageFromID) + ".txt",
- "r").read()) + "](https://www.google.com/#q=" + str(
- open("data/loc" + str(messageFromID) + ".txt", "r").read()).replace(" ",
- "+") + ")\n")
- else:
- Location = ""
- if os.path.isfile(str(chat_id) + "/data/" + str(messageFromID) + ".txt") == True:
- Warns = str(
- "Amount of warns: *(" + str(
- open(str(chat_id) + "/data/" + str(messageFromID) + ".txt", "r").read()) + "/3)*\n")
- else:
- Warns = ""
- usermessages = open(str(chat_id) + "/messages/" + str(messageFromID) + ".txt", "r").read()
- groupmessages = open(str(chat_id) + "/messagecount.txt", "r").read()
- percentage = round((int(usermessages) / int(groupmessages)) * 100, 2)
- print(percentage)
- if message == "/check":
- bot.sendMessage(chat_id, "*" + open(
- "data/n" + str(messageFromID) + ".txt").read() + " " + star + "*\n\nCoins: *" + str(
- open("rooms/" + str(messageFromID) + "money.txt",
- "r").read()) + "\n*Wins: *" + str(
- open("rooms/" + str(messageFromID) + "wins.txt",
- "r").read()) + "*\n%s%s%s%s%s%s%sYou've sent " % (
- Warns,
- Instagram, Reddit, Steam, Location, Soundcloud, Snapchat) + open(str(chat_id) +
- "/messages/" + str(
- messageFromID) + ".txt", "r").read() + " (" + str(
- percentage) + "%) and this group has " + open(str(chat_id) + "/messagecount.txt",
- "r").read() + " messages.",
- parse_mode="markdown", disable_web_page_preview=True)
- else:
- star = ""
- if os.path.isfile("data/n" + str(messageFromID) + ".txt") == False:
- if " help" in message:
- bot.sendMessage(chat_id,
- "You can add links to your /check message by sending this:\n/check instagram <instagram username>\n/check reddit <reddit username>\n/check steam <steam username>\n/check location <location>")
- if " instagram " in message:
- if "delete" in msg['text'][11:].lower():
- os.remove("data/insta" + str(messageFromID) + ".txt")
- bot.sendMessage(chat_id, "Instagram removed!")
- else:
- if len(msg['text'][11:].lower()) > 15:
- bot.sendMessage(chat_id, "Not a valid Instagram name.")
- else:
- open("data/insta" + str(messageFromID) + ".txt", "w").write(
- str(msg['text'][17:]))
- bot.sendMessage(chat_id, "Instagram set!")
- if " reddit " in message:
- if "delete" in msg['text'][11:].lower():
- os.remove("data/red" + str(messageFromID) + ".txt")
- bot.sendMessage(chat_id, "Reddit removed!")
- else:
- if len(msg['text'][11:].lower()) > 15:
- bot.sendMessage(chat_id, "Not a valid Reddit name.")
- else:
- open("data/red" + str(messageFromID) + ".txt", "w").write(
- str(msg['text'][14:]))
- bot.sendMessage(chat_id, "Reddit set!")
- if " steam " in message:
- if "delete" in msg['text'][11:].lower():
- os.remove("data/steam" + str(messageFromID) + ".txt")
- bot.sendMessage(chat_id, "Steam removed!")
- else:
- if len(msg['text'][11:].lower()) > 20:
- bot.sendMessage(chat_id, "Not a valid Steam name.")
- else:
- open("data/steam" + str(messageFromID) + ".txt", "w").write(
- str(msg['text'][13:]))
- bot.sendMessage(chat_id, "Steam set!")
- if " soundcloud " in message:
- if "delete" in msg['text'][13:].lower():
- os.remove("data/soundcloud" + str(messageFromID) + ".txt")
- bot.sendMessage(chat_id, "Steam removed!")
- else:
- if len(msg['text'][18:].lower()) > 20:
- bot.sendMessage(chat_id, "Not a valid Soundcloud name.")
- else:
- open("data/soundcloud" + str(messageFromID) + ".txt", "w").write(
- str(msg['text'][18:]))
- bot.sendMessage(chat_id, "Soundcloud set!")
- if " snapchat " in message:
- if "delete" in msg['text'][16:].lower():
- os.remove("data/snapchat" + str(messageFromID) + ".txt")
- bot.sendMessage(chat_id, "Snapchat removed!")
- else:
- if len(msg['text'][16:].lower()) > 15:
- bot.sendMessage(chat_id, "Not a valid Snapchat name.")
- else:
- open("data/snapchat" + str(messageFromID) + ".txt", "w").write(
- str(msg['text'][16:]))
- bot.sendMessage(chat_id, "Snapchat set!")
- if os.path.isfile(("data/soundcloud" + str(messageFromID) + ".txt")) == True:
- Soundcloud = str("Soundcloud: [" + str(
- open("data/soundcloud" + str(messageFromID) + ".txt",
- "r").read()) + "](https://soundcloud.com/" + str(
- open("data/soundcloud" + str(messageFromID) + ".txt",
- "r").read()) + ")\n")
- else:
- Soundcloud = ""
- if os.path.isfile(("data/snapchat" + str(messageFromID) + ".txt")) == True:
- Snapchat = str("Snapchat: [" + str(
- open("data/snapchat" + str(messageFromID) + ".txt",
- "r").read()) + "](https://www.snapchat.com/add/" + str(
- open("data/snapchat" + str(messageFromID) + ".txt",
- "r").read()) + ")\n")
- else:
- Snapchat = ""
- if " location " in message:
- if "delete" in msg['text'][11:].lower():
- os.remove("data/loc" + str(messageFromID) + ".txt")
- bot.sendMessage(chat_id, "Location removed!")
- else:
- if len(msg['text'][11:].lower()) > 30:
- bot.sendMessage(chat_id, "Not a valid Location name.")
- else:
- open("data/loc" + str(messageFromID) + ".txt", "w").write(
- str(msg['text'][15:]))
- bot.sendMessage(chat_id, "Location set!")
- if os.path.isfile(("data/insta" + str(messageFromID) + ".txt")) == True:
- Instagram = str(
- "Instagram: [" + str(open("data/insta" + str(messageFromID) + ".txt",
- "r").read()) + "](https://www.instagram.com/" + str(
- open("data/insta" + str(messageFromID) + ".txt", "r").read()) + ")\n")
- else:
- Instagram = ""
- if os.path.isfile(("data/steam" + str(messageFromID) + ".txt")) == True:
- Steam = str("Steam: [" + str(open("data/steam" + str(messageFromID) + ".txt",
- "r").read()) + "](http://steamcommunity.com/id/" + str(
- open("data/steam" + str(messageFromID) + ".txt", "r").read()) + ")\n")
- else:
- Steam = ""
- if os.path.isfile(("data/red" + str(messageFromID) + ".txt")) == True:
- Reddit = str("Reddit: [" + str(open("data/red" + str(messageFromID) + ".txt",
- "r").read()) + "](https://www.reddit.com/user/" + str(
- open("data/red" + str(messageFromID) + ".txt", "r").read()) + ")\n")
- else:
- Reddit = ""
- if os.path.isfile(("data/loc" + str(messageFromID) + ".txt")) == True:
- Location = str("Location: [" + str(open("data/loc" + str(messageFromID) + ".txt",
- "r").read()) + "](https://www.google.com/#q=" + str(
- open("data/loc" + str(messageFromID) + ".txt", "r").read()).replace(" ",
- "+") + ")\n")
- else:
- Location = ""
- if os.path.isfile(str(chat_id) + "/data/" + str(messageFromID) + ".txt") == True:
- Warns = str(
- "Amount of warns: *(" + str(open(str(chat_id) + "/data/" + str(messageFromID) + ".txt",
- "r").read()) + "/3)*\n")
- else:
- Warns = ""
- if message == "/check":
- bot.sendMessage(chat_id, "*" + msg['from']['first_name'] + " " + star + "*\n\nCoins: *" + str(
- open("rooms/" + str(messageFromID) + "money.txt",
- "r").read()) + "\n*Wins: *" + str(
- open("rooms/" + str(messageFromID) + "wins.txt",
- "r").read()) + "*\n%s%s%s%s%s%s%s" % (
- Warns,
- Instagram, Reddit, Steam, Location, Soundcloud, Snapchat), parse_mode="markdown", disable_web_page_preview=True)
- else:
- star = ""
- if " help" in message:
- bot.sendMessage(chat_id,
- "You can add links to your /check message by sending this:\n/check instagram <instagram username>\n/check snapchat <snapchat username>\n/check soundcloud <soundcloud username>\n/check reddit <reddit username>\n/check steam <steam username>\n/check location <location>")
- if " instagram " in message:
- if "delete" in msg['text'][17:].lower():
- os.remove("data/insta" + str(messageFromID) + ".txt")
- bot.sendMessage(chat_id, "Instagram removed!")
- else:
- if len(msg['text'][17:].lower()) > 15:
- bot.sendMessage(chat_id, "Not a valid Instagram name.")
- else:
- open("data/insta" + str(messageFromID) + ".txt", "w").write(
- str(msg['text'][17:]))
- bot.sendMessage(chat_id, "Instagram set!")
- if " snapchat " in message:
- if "delete" in msg['text'][16:].lower():
- os.remove("data/snapchat" + str(messageFromID) + ".txt")
- bot.sendMessage(chat_id, "Snapchat removed!")
- else:
- if len(msg['text'][16:].lower()) > 15:
- bot.sendMessage(chat_id, "Not a valid Snapchat name.")
- else:
- open("data/snapchat" + str(messageFromID) + ".txt", "w").write(
- str(msg['text'][16:]))
- bot.sendMessage(chat_id, "Snapchat set!")
- if " reddit " in message:
- if "delete" in msg['text'][14:].lower():
- os.remove("data/red" + str(messageFromID) + ".txt")
- bot.sendMessage(chat_id, "Reddit removed!")
- else:
- if len(msg['text'][14:].lower()) > 15:
- bot.sendMessage(chat_id, "Not a valid Reddit name.")
- else:
- open("data/red" + str(messageFromID) + ".txt", "w").write(
- str(msg['text'][14:]))
- bot.sendMessage(chat_id, "Reddit set!")
- if " soundcloud " in message:
- if "delete" in msg['text'][13:].lower():
- os.remove("data/soundcloud" + str(messageFromID) + ".txt")
- bot.sendMessage(chat_id, "Steam removed!")
- else:
- if len(msg['text'][18:].lower()) > 20:
- bot.sendMessage(chat_id, "Not a valid Soundcloud name.")
- else:
- open("data/soundcloud" + str(messageFromID) + ".txt", "w").write(
- str(msg['text'][18:]))
- bot.sendMessage(chat_id, "Soundcloud set!")
- if os.path.isfile(("data/soundcloud" + str(messageFromID) + ".txt")) == True:
- Soundcloud = str("Soundcloud: [" + str(
- open("data/soundcloud" + str(messageFromID) + ".txt",
- "r").read()) + "](https://soundcloud.com/" + str(
- open("data/soundcloud" + str(messageFromID) + ".txt",
- "r").read()) + ")\n")
- else:
- Soundcloud = ""
- if os.path.isfile(("data/snapchat" + str(messageFromID) + ".txt")) == True:
- Snapchat = str("Snapchat: [" + str(
- open("data/snapchat" + str(messageFromID) + ".txt",
- "r").read()) + "](https://www.snapchat.com/add/" + str(
- open("data/snapchat" + str(messageFromID) + ".txt",
- "r").read()) + ")\n")
- else:
- Snapchat = ""
- if " steam " in message:
- if "delete" in msg['text'][13:].lower():
- os.remove("data/steam" + str(messageFromID) + ".txt")
- bot.sendMessage(chat_id, "Steam removed!")
- else:
- if len(msg['text'][13:].lower()) > 20:
- bot.sendMessage(chat_id, "Not a valid Steam name.")
- else:
- open("data/steam" + str(messageFromID) + ".txt", "w").write(
- str(msg['text'][13:]))
- bot.sendMessage(chat_id, "Steam set!")
- if " location " in message:
- if "delete" in msg['text'].lower():
- os.remove("data/loc" + str(messageFromID) + ".txt")
- bot.sendMessage(chat_id, "Location removed!")
- else:
- if len(msg['text'].lower()) > 30:
- bot.sendMessage(chat_id, "Not a valid Location name.")
- else:
- open("data/loc" + str(messageFromID) + ".txt", "w").write(
- str(msg['text'][15:]))
- bot.sendMessage(chat_id, "Location set!")
- if os.path.isfile(("data/insta" + str(messageFromID) + ".txt")) == True:
- Instagram = str(
- "Instagram: [" + str(open("data/insta" + str(messageFromID) + ".txt",
- "r").read()) + "](https://www.instagram.com/" + str(
- open("data/insta" + str(messageFromID) + ".txt", "r").read()) + ")\n")
- else:
- Instagram = ""
- if os.path.isfile(("data/steam" + str(messageFromID) + ".txt")) == True:
- Steam = str("Steam: [" + str(open("data/steam" + str(messageFromID) + ".txt",
- "r").read()) + "](http://steamcommunity.com/id/" + str(
- open("data/steam" + str(messageFromID) + ".txt", "r").read()) + ")\n")
- else:
- Steam = ""
- if os.path.isfile(("data/red" + str(messageFromID) + ".txt")) == True:
- Reddit = str("Reddit: [" + str(open("data/red" + str(messageFromID) + ".txt",
- "r").read()) + "](https://www.reddit.com/user/" + str(
- open("data/red" + str(messageFromID) + ".txt", "r").read()) + ")\n")
- else:
- Reddit = ""
- if os.path.isfile(("data/loc" + str(messageFromID) + ".txt")) == True:
- Location = str("Location: [" + str(open("data/loc" + str(messageFromID) + ".txt",
- "r").read()) + "](https://www.google.com/#q=" + str(
- open("data/loc" + str(messageFromID) + ".txt", "r").read()).replace(" ",
- "+") + ")\n")
- else:
- Location = ""
- if os.path.isfile(str(chat_id) + "/data/" + str(messageFromID) + ".txt") == True:
- Warns = str(
- "Amount of warns: *(" + str(
- open(str(chat_id) + "/data/" + str(messageFromID) + ".txt", "r").read()) + "/3)*\n")
- else:
- Warns = ""
- if message == "/check":
- bot.sendMessage(chat_id, "*" + open(
- "data/n" + str(messageFromID) + ".txt").read() + " " + star + "*\n\nCoins: *" + str(
- open("rooms/" + str(messageFromID) + "money.txt",
- "r").read()) + "\n*Wins: *" + str(
- open("rooms/" + str(messageFromID) + "wins.txt",
- "r").read()) + "*\n%s%s%s%s%s%s%s" % (
- Warns,
- Instagram, Reddit, Steam, Location, Soundcloud, Snapchat),
- parse_mode="markdown", disable_web_page_preview=True)
- if "hi bot" in message:
- if os.path.isfile("data/n" + str(messageFromID) + ".txt") == False:
- bot.sendMessage(chat_id, "Hi, " + msg['from']['first_name'][:15] + "!")
- else:
- bot.sendMessage(chat_id, "Hi, " + open("data/n" + str(messageFromID) + ".txt").read() + "!")
- if messageType == "private":
- if "/start" in message:
- if os.path.isfile("data/n" + str(messageFromID) + ".txt") == False:
- bot.sendMessage(chat_id, "Hi, " + msg['from']['first_name'][:15] + ". I am @ImmaChatBot, and I am a multi-purpose chat bot! Use /help to see my commands and how to use me. Or, for account help, enter /account.")
- else:
- bot.sendMessage(chat_id, "Hi, " + open("data/n" + str(messageFromID) + ".txt").read() + ". I am @ImmaChatBot, and I am a multi-purpose chat bot! Use /help to see my commands and how to use me. Or, for account help, enter /account.")
- if "/help" in message:
- bot.sendMessage(chat_id, "Commands:\n/roll and /roll2\n/saturate\n/solarize\n/posterize\n/swirl\n/polaroid\n/rblur\n/caption and /captionb for black text\n/kickme\n/def\n/jokes\n/callme\n/addcom and /delcom (add custom commands)\n/blur\n/contour\n/check\n/equalize\n/sharpen\n/invert\n/equalize\n/imagesearch\n\nAdmin Commands:\n/time (for games)\n/promote and /demote\n/ban and /unban\n/kick\n/mute and /unmute\n/byebot (Makes the bot leave the group)\n/photo\n/wel (Toggles welcome message)\n/eb (Toggles 8ball)\n/jt (Toggles jokes)\n/rt (Toggles rolling)\n/gt (Toggles games)\n/reset (Removes warns)\n/end (Ends current game)\n/toggles (Shows whats on and off, some are fillers)\n/time (Set's game time limit)")
- def sticker():
- if 'reply_to_message' in msg:
- try:
- Bot.send_chat_action(chat_id, action=telegram.ChatAction.TYPING)
- file_id = msg['reply_to_message']['photo'][2]['file_id']
- filename = str(msg['reply_to_message']['from']['id']) + ".png"
- bot.download_file(file_id, filename)
- im = Image.open(filename)
- im.thumbnail((512, 512))
- im.save("1" + filename)
- bot.sendDocument(chat_id, open("1" + filename, "rb"))
- os.remove(filename)
- os.remove("1" + filename)
- except:
- bot.sendMessage(chat_id, "Error occured")
- else:
- bot.sendMessage(chat_id, "Reply to a photo.")
- if "/stick" in message:
- t = threading.Thread(target=sticker)
- t.start()
- if "/forget" in message:
- if os.path.isfile("data/n" + str(messageFromID) + ".txt") == True:
- bot.sendMessage(chat_id, "_Your name has been forgotten_", parse_mode="markdown")
- os.remove("data/n" + str(messageFromID) + ".txt")
- if "/imagesearch" in message:
- t = threading.Thread(target=imagesearch)
- t.start()
- if messageType == 'private':
- if os.path.isfile("login/" + str(messageFromID) + "LOGGED.txt") == False:
- if "/login" in message:
- contenttype, chattype, chatid = telepot.glance(msg)
- keyboard = InlineKeyboardMarkup(inline_keyboard=[[InlineKeyboardButton(text="Create Account", callback_data='create_')],
- [InlineKeyboardButton(text="Cancel", callback_data='cancel_')]])
- edited = telepot.message_identifier(bot.sendMessage(chat_id, 'Enter your username:', reply_markup=keyboard))
- if os.path.isfile(str(messageFromID) + "login.txt") == False:
- open(str(messageFromID) + "login.txt", "w").write("username")
- elif "/account" in message:
- bot.sendMessage(chat_id, "Hmm.. looks like you're not logged in. Type /login to login, or /create to create an account!")
- elif "/create" in message:
- bot.sendMessage(chat_id, "Alright, what would you like your username to be? (5-18 characters)")
- open(str(messageFromID) + "login.txt", "w").write("createusername")
- open(str(messageFromID) + "data.txt", "w").write(str(messageFromID))
- elif os.path.isfile(str(messageFromID) + "login.txt") == True:
- if open(str(messageFromID) + "login.txt", "r").read() == "username":
- if os.path.isfile("login/" + str(msg['text']) + "login.txt") == False:
- if "/cancel" in message:
- os.remove(str(messageFromID) + "login.txt")
- bot.sendMessage(chat_id, "All operations have been canceled.")
- elif '/login' in message:
- ()
- else:
- bot.sendMessage(chat_id, "This username is not in my database. Try again.")
- elif os.path.isfile('login/' + str(msg['text']) + 'AUTH.txt'):
- open('login/request' + str(msg['text']) + '.txt', 'w').write(str(messageFromID) + '\n' + str(msg['from']['first_name']))
- bot.sendMessage(str(open('login/' + str(msg['text']) + 'AUTH.txt').read()), 'The user, ' + str(open('login/request' + str(msg['text']) + '.txt').read().splitlines()[1] + ', has requested to login. /accept or /decline?'))
- open('login/requesttype.txt', 'w').write('logged')
- bot.sendMessage(chat_id, 'This account has 2-Factor Auth activated. A message has been sent to the account owner. If it is you, go on the account and click /accept.')
- else:
- open(str(messageFromID) + "usernameinput.txt", "w").write(str(msg['text']).replace("[", "").replace("'", "").replace("]", ""))
- open(str(messageFromID) + "login.txt", "w").write("password")
- bot.sendMessage(chat_id, "Enter your password:")
- elif "createusername" in open(str(messageFromID) + "login.txt", "r").read():
- if str(messageFromID) in open(str(messageFromID) + "data.txt", "r").read():
- if os.path.isfile("login/" + str(msg['text']) + "login.txt") == False:
- if "/cancel" in message:
- os.remove(str(messageFromID) + "login.txt")
- bot.sendMessage(chat_id, "All operations have been canceled.")
- else:
- if " " in msg['text'].lower():
- bot.sendMessage(chat_id,
- "You can not have special characters in your username. Like a space..")
- else:
- if len(msg['text'].lower()) > 18:
- bot.sendMessage(chat_id, "That username is too long. Please try a shorter one.")
- elif len(msg['text'].lower()) < 5:
- bot.sendMessage(chat_id,
- "That username is too short. Please try to put a little more.")
- else:
- open("login/" + str(msg['text']) + "login.txt", "w").write(str(""))
- open("login/temp" + str(messageFromID) + ".txt", "w").write(
- str(msg['text'].lower()))
- open(str(messageFromID) + "login.txt", "w").write("createpassword")
- bot.sendMessage(chat_id,
- "What would you like your password to be? (5-18 characters):")
- else:
- bot.sendMessage(chat_id, "That username is already taken, please try again.")
- elif "createpassword" in open(str(messageFromID) + "login.txt", "r").read():
- if " " in msg['text'].lower():
- bot.sendMessage(chat_id,
- "You can not have special characters in your password. Like a space..")
- else:
- if len(msg['text'].lower()) > 18:
- bot.sendMessage(chat_id, "That password is too long. Please try a shorter one.")
- elif len(msg['text'].lower()) < 5:
- bot.sendMessage(chat_id, "That password is too short. Please try to put a little more.")
- elif "/cancel" in message:
- os.remove(str(messageFromID) + "login.txt")
- bot.sendMessage(chat_id, "All operations have been canceled. Account was not made.")
- os.remove('login/temp' + str(messageFromID) + ".txt")
- else:
- open(str(messageFromID) + "login.txt", "w").write("saveusername")
- bot.sendMessage(chat_id, "Account created! Type /login to login.")
- open("login/" + open("login/temp" + str(messageFromID) + ".txt",
- "r").read() + "login.txt", "w").write(
- str(msg['text']))
- os.remove(str(messageFromID) + "login.txt")
- os.remove('login/temp' + str(messageFromID) + ".txt")
- elif "password" in open(str(messageFromID) + "login.txt", "r").read():
- open("login/" + str(
- open(str(messageFromID) + "usernameinput.txt", "r").read()) + "login.txt", "r").read()
- if str(msg['text']) == open("login/" + str(
- open(str(messageFromID) + "usernameinput.txt", "r").read()) + "login.txt",
- "r").read():
- os.remove(str(messageFromID) + "login.txt")
- open("login/" + str(messageFromID) + "LOGGED.txt", "w").write(
- str(open(str(messageFromID) + "usernameinput.txt", "r").read()))
- if os.path.isfile('login/' + str(open("login/" + str(messageFromID) + "LOGGED.txt", 'r').read()) + 'AMOUNT.txt') == False:
- open('login/' + str(open("login/" + str(messageFromID) + "LOGGED.txt", 'r').read()) + 'AMOUNT.txt', 'w').write('1')
- else:
- aadd = int(str(open('login/' + str(open("login/" + str(messageFromID) + "LOGGED.txt", 'r').read()) + 'AMOUNT.txt').read())) + 1
- open('login/' + str(open("login/" + str(messageFromID) + "LOGGED.txt", 'r').read()) + 'AMOUNT.txt', 'w').write(str(aadd))
- bot.sendMessage(chat_id, "You are now logged into " + str(open("login/" + str(messageFromID) + "LOGGED.txt").read()) + "!\nType /account to get started.")
- elif "/cancel" in message:
- os.remove(str(messageFromID) + "login.txt")
- bot.sendMessage(chat_id, "All operations have been canceled.")
- os.remove(str(messageFromID) + "login.txt")
- else:
- bot.sendMessage(chat_id, "Incorrect password. Try again.")
- elif os.path.isfile(str(messageFromID) + "usernameinput.txt") == True:
- if os.path.isfile(str(
- open(str(messageFromID) + "usernameinput.txt", "r").read()) + "login.txt") == True:
- if open(str(open(str(messageFromID) + "usernameinput.txt", "r").read()) + "login.txt"):
- open(str(messageFromID) + "login.txt", "w").write("password")
- elif "saveusername" in open(str(messageFromID) + "login.txt", "r").read():
- if str(messageFromID) in open(str(messageFromID) + "data.txt", "r").read():
- if os.path.isfile("login/temp" + str(messageFromID) + ".txt") == True:
- open("login/" + open("login/temp" + str(messageFromID) + ".txt",
- "r").read() + "login.txt", "w").write(str(msg['text']))
- os.remove(str(messageFromID) + "login.txt")
- else:
- if os.path.isfile('login/' + str(open("login/" + str(messageFromID) + "LOGGED.txt").read()) + 'login.txt') == False:
- bot.sendMessage(chat_id, 'You have been signed out. This account has been deleted.')
- os.remove("login/" + str(messageFromID) + 'LOGGED.txt')
- else:
- if os.path.isfile('login/deactivate' + str(messageFromID) + '.txt') == False:
- if "/login" in message:
- bot.sendMessage(chat_id, "You are currently signed into " + str(open("login/" + str(messageFromID) + "LOGGED.txt").read()) + ". To logout, type /logout")
- elif os.path.isfile(str(msg['from']['id']) + 'login.txt') == True:
- if "changepassword" in open(str(messageFromID) + "login.txt", "r").read():
- if str(msg['text']) == open("login/" + str(
- open("login/" + str(messageFromID) + "LOGGED.txt", "r").read()) + "login.txt",
- "r").read():
- bot.sendMessage(chat_id, 'Enter your new password:')
- open(str(msg['from']['id']) + 'login.txt', 'w').write('changing')
- else:
- bot.sendMessage(chat_id, 'That password is incorrect, try again.')
- elif 'changing' in open(str(messageFromID) + 'login.txt').read():
- open('login/' + str(open("login/" + str(messageFromID) + 'LOGGED.txt').read()) + 'login.txt' , 'w').write(str(msg['text']))
- bot.sendMessage(chat_id, 'Password changed!')
- os.remove(str(msg['from']['id']) + 'login.txt')
- elif "/create" in message:
- bot.sendMessage(chat_id, "You are currently signed into " + str(open("login/" + str(messageFromID) + "LOGGED.txt").read()) + ". To logout, type /logout")
- elif "/settings" in message:
- bot.sendMessage(chat_id, "Settings:\n\n/2auth - Toggles 2-Factor Auth on your account.\n/logout - Logs out of current account.\n/sync - Used to sync data.\n/deactivate - deletes the account you're logged into.")
- elif "/account" in message:
- if os.path.isfile('login/' + str(
- open('login/' + str(messageFromID) + 'LOGGED.txt').read()) + 'AUTH.txt') == True:
- auth = 'Activated'
- else:
- auth = 'Deactivated'
- keyboard = InlineKeyboardMarkup(
- inline_keyboard=[[InlineKeyboardButton(text="Change Password", callback_data='changepassword_')],
- [InlineKeyboardButton(text="Logout", callback_data='logout_')]])
- edited = telepot.message_identifier(
- bot.sendMessage(chat_id, '┌*Username*: ' + str(open('login/' + str(messageFromID) + 'LOGGED.txt').read()) + '\n├*Password*: ' + '••••••••\n├*2-Auth*: ' + auth + '\n└*# of sessions*: ' + str(open('login/' + str(
- open("login/" + str(messageFromID) + "LOGGED.txt", 'r').read()) + 'AMOUNT.txt').read()), parse_mode='markdown', reply_markup=keyboard))
- #elif "/2auth" in message:
- # bot.sendMessage(chat_id, "2-Auth has been activated.")
- # #open('login/' + str(open('login/' + str(open('login/' + str(messageFromID) + 'LOGGED.txt').read()) + 'DATA.txt', 'r').read().splitlines()[2]) + 'AUTH.txt', 'w').write()
- # open('login/' + str(open('login/' + str(messageFromID) + 'LOGGED.txt').read()) + 'AUTH.txt', 'w').write(str(messageFromID))
- elif "/2auth" in message:
- if os.path.isfile('login/' + str(open('login/' + str(messageFromID) + 'LOGGED.txt').read()) + 'AUTH.txt') == True:
- os.remove('login/' + str(open('login/' + str(messageFromID) + 'LOGGED.txt').read()) + 'AUTH.txt')
- bot.sendMessage(chat_id, "2-Factor Authentication has been disabled.")
- else:
- open('login/' + str(open('login/' + str(messageFromID) + 'LOGGED.txt').read()) + 'AUTH.txt',
- 'w').write(str(messageFromID))
- bot.sendMessage(chat_id, "2-Factor Authentication has been enabled.")
- elif "/deactivate" in msg['text'].lower():
- if os.path.isfile('login/' + str(open('login/' + str(messageFromID) + 'LOGGED.txt').read()) + 'AUTH.txt') == True:
- #open('login/request' + str(msg['text']) + '.txt', 'w').write(str(messageFromID) + '\n' + str(msg['from']['first_name']))
- open('login/request' + str(messageFromID) + '.txt', 'w').write(str(messageFromID))
- bot.sendMessage(str(open('login/' + str(open('login/' + str(messageFromID) + 'LOGGED.txt').read()) + 'AUTH.txt').read()), 'The user, ' + str(open('login/request' + str(messageFromID) + '.txt').read().splitlines()[0] + ', has requested to deactivate this account. /accept or /decline'))
- open('login/requesttype.txt', 'w').write('deactivate')
- bot.sendMessage(chat_id, "To deactivate, click /accept on host account. If you don't have access to this account, contact @spoon")
- else:
- bot.sendMessage(chat_id, "Enter password to deactivate:")
- open('login/deactivate' + str(messageFromID) + '.txt', 'w').write('deactivate')
- elif "/accept" in message:
- if 'logged' in open('login/requesttype.txt').read():
- open('login/request' + str(open('login/' + str(messageFromID) + 'LOGGED.txt').read()) + '.txt').read()
- open('login/' + str(open('login/request' + str(open('login/' + str(messageFromID) + 'LOGGED.txt').read()) + '.txt').read().splitlines()[0]) + 'LOGGED.txt', 'w').write(str(open("login/" + str(messageFromID) + "LOGGED.txt").read()))
- bot.sendMessage(str(open('login/request' + str(open('login/' + str(messageFromID) + 'LOGGED.txt').read()) + '.txt').read().splitlines()[0]), 'You were accepted. You are now logged in!')
- os.remove('login/request' + str(open('login/' + str(messageFromID) + 'LOGGED.txt').read()) + '.txt')
- aadd = int(str(open('login/' + str(open("login/" + str(messageFromID) + "LOGGED.txt", 'r').read()) + 'AMOUNT.txt').read())) + 1
- open('login/' + str(open("login/" + str(messageFromID) + "LOGGED.txt", 'r').read()) + 'AMOUNT.txt', 'w').write(str(aadd))
- os.remove('login/requesttype.txt')
- else:
- if os.path.isfile('login/' + str(open('login/' + str(messageFromID) + 'LOGGED.txt').read()) + 'DATA.txt'):
- os.remove('login/' + str(open('login/' + str(messageFromID) + 'LOGGED.txt').read()) + 'DATA.txt')
- if os.path.isfile('login/' + str(open('login/' + str(messageFromID) + 'LOGGED.txt').read()) + 'AUTH.txt'):
- os.remove('login/' + str(open('login/' + str(messageFromID) + 'LOGGED.txt').read()) + 'AUTH.txt')
- if os.path.isfile('login/' + str(open('login/' + str(messageFromID) + 'LOGGED.txt').read()) + 'login.txt'):
- os.remove('login/' + str(open('login/' + str(messageFromID) + 'LOGGED.txt').read()) + 'login.txt')
- os.remove('login/' + str(messageFromID) + 'LOGGED.txt')
- os.remove('login/request' + str(messageFromID) + '.txt')
- os.remove('login/requesttype.txt')
- bot.sendMessage(chat_id, 'This account has been deactivated. You have been logged out.')
- elif "/logout" in message:
- if os.path.isfile('login/' + str(
- open('login/' + str(messageFromID) + 'LOGGED.txt').read()) + 'AUTH.txt'):
- if str(messageFromID) in open('login/' + str(open("login/" + str(messageFromID) + "LOGGED.txt", 'r').read()) + 'AUTH.txt').read():
- bot.sendMessage(chat_id, "You have logged out of " + str(open("login/" + str(
- messageFromID) + "LOGGED.txt").read()) + '. 2-Auth has been deactivated.')
- if '1' in open('login/' + str(open("login/" + str(messageFromID) + "LOGGED.txt", 'r').read()) + 'AMOUNT.txt').read():
- os.remove('login/' + str(open("login/" + str(messageFromID) + "LOGGED.txt", 'r').read()) + 'AMOUNT.txt')
- os.remove("login/" + str(open("login/" + str(messageFromID) + "LOGGED.txt").read()) + "AUTH.txt")
- os.remove("login/" + str(messageFromID) + "LOGGED.txt")
- else:
- aadd = int(str(open('login/' + str(open("login/" + str(messageFromID) + "LOGGED.txt", 'r').read()) + 'AMOUNT.txt').read())) - 1
- open('login/' + str(open("login/" + str(messageFromID) + "LOGGED.txt", 'r').read()) + 'AMOUNT.txt', 'w').write(str(aadd))
- else:
- if '1' in open('login/' + str(open("login/" + str(messageFromID) + "LOGGED.txt",
- 'r').read()) + 'AMOUNT.txt').read():
- os.remove('login/' + str(open("login/" + str(messageFromID) + "LOGGED.txt",
- 'r').read()) + 'AMOUNT.txt')
- else:
- aadd = int(str(open('login/' + str(
- open("login/" + str(messageFromID) + "LOGGED.txt",
- 'r').read()) + 'AMOUNT.txt').read())) - 1
- open('login/' + str(open("login/" + str(messageFromID) + "LOGGED.txt",
- 'r').read()) + 'AMOUNT.txt', 'w').write(str(aadd))
- bot.sendMessage(chat_id, "You have logged out of " + str(
- open("login/" + str(messageFromID) + "LOGGED.txt").read()) + '.')
- os.remove("login/" + str(messageFromID) + "LOGGED.txt")
- else:
- bot.sendMessage(chat_id, "You have logged out of " + str(open("login/" + str(messageFromID) + "LOGGED.txt").read()) + '.')
- if '1' in open('login/' + str(open("login/" + str(messageFromID) + "LOGGED.txt", 'r').read()) + 'AMOUNT.txt').read():
- os.remove('login/' + str(open("login/" + str(messageFromID) + "LOGGED.txt", 'r').read()) + 'AMOUNT.txt')
- os.remove("login/" + str(messageFromID) + "LOGGED.txt")
- else:
- aadd = int(str(open('login/' + str(open("login/" + str(messageFromID) + "LOGGED.txt", 'r').read()) + 'AMOUNT.txt').read())) - 1
- open('login/' + str(open("login/" + str(messageFromID) + "LOGGED.txt", 'r').read()) + 'AMOUNT.txt', 'w').write(str(aadd))
- elif "/sync" in message:
- bot.sendMessage(chat_id, "Would you like to /save or /load?\n(WARNING: Saving will replace old saved data, and loading will replace your current wins and money.)")
- open("login/" + str(messageFromID) + "syncing.txt", "w").write("selection")
- elif os.path.isfile("login/" + str(messageFromID) + "syncing.txt") == True:
- if 'selection' in open("login/" + str(messageFromID) + "syncing.txt", "r").read():
- if '/save' in message:
- bot.sendMessage(chat_id, "Saving all data...")
- bot.sendMessage(chat_id, "Saved!")
- wins = str(open('rooms/' + str(messageFromID) + "wins.txt").read())
- money = str(open('rooms/' + str(messageFromID) + "money.txt").read())
- wrote = str(messageFromID)
- open('login/' + str(open('login/' + str(messageFromID) + "LOGGED.txt", 'r').read()) + "DATA.txt", 'w').write(wins + '\n' + money + '\n' + wrote)
- os.remove("login/" + str(messageFromID) + "syncing.txt")
- elif '/load' in message:
- bot.sendMessage(chat_id, "Getting saved data...")
- bot.sendMessage(chat_id, "Loaded!")
- open('rooms/' + str(messageFromID) + "wins.txt", 'w').write(str(open('login/' + str(open('login/' + str(messageFromID) + 'LOGGED.txt').read()) + 'DATA.txt', 'r').read().splitlines()[0]))
- open('rooms/' + str(messageFromID) + "money.txt", 'w').write(str(open(
- 'login/' + str(open('login/' + str(messageFromID) + 'LOGGED.txt').read()) + 'DATA.txt',
- 'r').read().splitlines()[1]))
- open('rooms/' + str(messageFromID) + "money.txt", 'w').write(str(open(
- 'login/' + str(open('login/' + str(messageFromID) + 'LOGGED.txt').read()) + 'DATA.txt',
- 'r').read().splitlines()[1]))
- open('rooms/' + str(open('login/' + str(open('login/' + str(messageFromID) + 'LOGGED.txt').read()) + 'DATA.txt', 'r').read().splitlines()[2]) + 'wins.txt', 'w').write('0')
- open('rooms/' + str(open('login/' + str(open('login/' + str(messageFromID) + 'LOGGED.txt').read()) + 'DATA.txt', 'r').read().splitlines()[2]) + 'money.txt', 'w').write('0')
- os.remove("login/" + str(messageFromID) + "syncing.txt")
- if "/cancel" in message:
- os.remove(str(messageFromID) + "login.txt")
- bot.sendMessage(chat_id, "All operations have been canceled.")
- if "/test" in message:
- dir_list = next(os.walk('.'))[1]
- if str(dir_list[1]).startswith('-'):
- print(dir_list[1])
- elif 'deactivate' in open('login/deactivate' + str(messageFromID) + '.txt').read():
- if str(msg['text']) == open("login/" + str(
- open("login/" + str(messageFromID) + "LOGGED.txt", "r").read()) + "login.txt",
- "r").read():
- if os.path.isfile('login/' + str(
- open('login/' + str(messageFromID) + 'LOGGED.txt').read()) + 'DATA.txt') == True:
- os.remove('login/' + str(
- open('login/' + str(messageFromID) + 'LOGGED.txt').read()) + 'DATA.txt')
- if os.path.isfile('login/' + str(
- open('login/' + str(messageFromID) + 'LOGGED.txt').read()) + 'AUTH.txt') == True:
- os.remove('login/' + str(
- open('login/' + str(messageFromID) + 'LOGGED.txt').read()) + 'AUTH.txt')
- if os.path.isfile('login/' + str(
- open('login/' + str(messageFromID) + 'LOGGED.txt').read()) + 'login.txt') == True:
- os.remove('login/' + str(
- open('login/' + str(messageFromID) + 'LOGGED.txt').read()) + 'login.txt')
- os.remove('login/' + str(
- open('login/' + str(messageFromID) + 'LOGGED.txt').read()) + 'AMOUNT.txt')
- os.remove('login/' + str(messageFromID) + 'LOGGED.txt')
- bot.sendMessage(chat_id, 'This account has been deactivated. You have been logged out.')
- os.remove('login/deactivate' + str(messageFromID) + '.txt')
- else:
- bot.sendMessage(chat_id, 'Incorrect password. Retry later.')
- os.remove('login/deactivate' + str(messageFromID) + '.txt')
- if messageType != 'private':
- if "True" in open(str(chat_id) + "/data/8ball.txt", "r"):
- if "/magic8 " in message:
- bot.sendMessage(chat_id, (random.choice(eightball)),
- reply_to_message_id=msg['message_id'])
- if message == "/magic8":
- bot.sendMessage(chat_id, '/magic8 <question>')
- if message == '/m8':
- bot.sendMessage(chat_id, "/m8 <question>")
- if message == '/m8@ImmaChatBot':
- bot.sendMessage(chat_id, "/m8 <question>")
- if "/m8 " in message:
- bot.sendMessage(chat_id, (random.choice(eightball)),
- reply_to_message_id=msg['message_id'])
- if '/remove' in message:
- reply_markup = telegram.ReplyKeyboardRemove()
- Bot.sendMessage(chat_id=chat_id, text="removed.", reply_markup=reply_markup)
- global edited
- def on_callback_query(msg):
- query_id, from_id, query_data = telepot.glance(msg, flavor='callback_query')
- if query_data == 'create_':
- keyboard = InlineKeyboardMarkup(
- inline_keyboard=[[InlineKeyboardButton(text="Cancel", callback_data='cancel_')]])
- bot.editMessageText(edited, "Alright, what would you like your username to be? (5-18 characters)", reply_markup=keyboard)
- open(str(msg['from']['id']) + "login.txt", "w").write("createusername")
- open(str(msg['from']['id']) + "data.txt", "w").write(str(msg['from']['id']))
- elif query_data == 'cancel_':
- os.remove(str(from_id) + "login.txt")
- bot.editMessageText(edited, "All operations have been canceled.")
- elif query_data == 'changepassword_':
- keyboard = InlineKeyboardMarkup(
- inline_keyboard=[[InlineKeyboardButton(text="Back", callback_data='Back_')]])
- open(str(msg['from']['id']) + "login.txt", "w").write("changepassword")
- bot.editMessageText(edited, "Enter your old password:", reply_markup=keyboard)
- elif query_data == 'logout_':
- if os.path.isfile('login/' + str(
- open('login/' + str(from_id) + 'LOGGED.txt').read()) + 'AUTH.txt'):
- if str(from_id) in open('login/' + str(
- open("login/" + str(from_id) + "LOGGED.txt", 'r').read()) + 'AUTH.txt').read():
- bot.editMessageText(edited, "You have logged out of " + str(open("login/" + str(
- from_id) + "LOGGED.txt").read()) + '. 2-Auth has been deactivated.')
- if '1' in open('login/' + str(
- open("login/" + str(from_id) + "LOGGED.txt", 'r').read()) + 'AMOUNT.txt').read():
- os.remove(
- 'login/' + str(open("login/" + str(from_id) + "LOGGED.txt", 'r').read()) + 'AMOUNT.txt')
- os.remove("login/" + str(open("login/" + str(from_id) + "LOGGED.txt").read()) + "AUTH.txt")
- os.remove("login/" + str(from_id) + "LOGGED.txt")
- else:
- aadd = int(str(open('login/' + str(
- open("login/" + str(from_id) + "LOGGED.txt", 'r').read()) + 'AMOUNT.txt').read())) - 1
- open('login/' + str(open("login/" + str(from_id) + "LOGGED.txt", 'r').read()) + 'AMOUNT.txt',
- 'w').write(str(aadd))
- else:
- if '1' in open('login/' + str(open("login/" + str(from_id) + "LOGGED.txt",
- 'r').read()) + 'AMOUNT.txt').read():
- os.remove('login/' + str(open("login/" + str(from_id) + "LOGGED.txt",
- 'r').read()) + 'AMOUNT.txt')
- else:
- aadd = int(str(open('login/' + str(
- open("login/" + str(from_id) + "LOGGED.txt",
- 'r').read()) + 'AMOUNT.txt').read())) - 1
- open('login/' + str(open("login/" + str(from_id) + "LOGGED.txt",
- 'r').read()) + 'AMOUNT.txt', 'w').write(str(aadd))
- bot.editMessageText(edited, "You have logged out of " + str(
- open("login/" + str(from_id) + "LOGGED.txt").read()) + '.')
- os.remove("login/" + str(from_id) + "LOGGED.txt")
- else:
- bot.editMessageText(edited, "You have logged out of " + str(
- open("login/" + str(from_id) + "LOGGED.txt").read()) + '.')
- if '1' in open('login/' + str(
- open("login/" + str(from_id) + "LOGGED.txt", 'r').read()) + 'AMOUNT.txt').read():
- os.remove('login/' + str(open("login/" + str(from_id) + "LOGGED.txt", 'r').read()) + 'AMOUNT.txt')
- os.remove("login/" + str(from_id) + "LOGGED.txt")
- else:
- aadd = int(str(open('login/' + str(
- open("login/" + str(from_id) + "LOGGED.txt", 'r').read()) + 'AMOUNT.txt').read())) - 1
- open('login/' + str(open("login/" + str(from_id) + "LOGGED.txt", 'r').read()) + 'AMOUNT.txt',
- 'w').write(str(aadd))
- else:
- bot.editMessageText(edited, "please..",
- parse_mode="markdown")
- bot = telepot.Bot(no lol)
- Bot = telegram.Bot(no lol)
- #bot.message_loop(handle)
- bot.message_loop({'chat': handle,
- 'callback_query': on_callback_query})
- while 1:
- time.sleep(10)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement