diff --git a/bot.py b/bot.py index a9b406d..3b70984 100644 --- a/bot.py +++ b/bot.py @@ -1,78 +1,75 @@ -# unfunny.py -import asyncio -import json -import os -import random -import secrets -import shutil -import string -import subprocess -import threading -import time -from time import sleep -from datetime import datetime -import sqlite3 - -import bs4 as bs -import cleverbotfreeapi import discord -import requests -import tracemoepy -from PIL import Image, ImageDraw, ImageFont -from PyDictionary import PyDictionary from discord.ext import commands from discord.ext.commands import MemberConverter +import string +import secrets +import requests +import json +import bs4 as bs +import time +import threading +from time import sleep +import asyncio +from selenium import webdriver +import os +import random +import shutil +import cleverbotfreeapi +from PyDictionary import PyDictionary +import gender_guesser.detector as gender from google_images_search import GoogleImagesSearch +import subprocess +from PIL import Image, ImageDraw, ImageFont from translate import Translator +import tracemoepy +from urllib.parse import urlparse +import sqlite3 +from datetime import datetime +import uuid +from saucenao_api import SauceNao +import html2text +import re -connection = sqlite3.connect("tagbot.sqlite") - -TOKEN = ('') - -bot = commands.Bot(command_prefix='%', - description='''For detailed help, See https://gitlab.com/SosoM1k0r31z31/funny-cat/-/wikis/commands''') +TOKEN = ('????????????????????????????????????????????????') +bot = commands.Bot(command_prefix='%', description='''For detailed help, See https://gitlab.com/SosoM1k0r31z31/funny-cat/-/wikis/commands''') +connection = sqlite3.connect("dbs/tagbot.sqlite") +connection2 = sqlite3.connect("dbs/msgarchive.sqlite") @bot.event async def on_ready(): print("ready ass") - + bot.remove_command('help') @bot.command() async def help(ctx): - msg = (f"{ctx.author.mention} https://gitlab.com/SosoM1k0r31z31/funny-cat/-/wikis/commands") + msg = (f"{ctx.author.mention} https://bitbucket.org/SosoM1k0r31z31/funny-cat/wiki/commands\n\nNo JS?\nhttps://sosom1k0r31z31.bitbucket.io/") await ctx.send(msg) - def randomnumbergen(range1, range2): a = int(range1) b = int(range2) - + r = requests.get(f"https://www.random.org/integers/?num=1&min={a}&max={b}&col=1&base=10&format=plain&rnd=new") randnumber = (r.text) y = randnumber.strip() z = int(y) return z - + @bot.command() -async def accountage(ctx, *, id): +async def accountage(ctx, avamember: discord.Member = None): if id == None: - msg = ( - f"{ctx.author.name} Info:\nJoin date: {ctx.author.joined_at}\nAccount creation date: {ctx.author.created_at}\nAvatar URL: {ctx.author.avatar_url}") + msg = (f"{ctx.author.name} Info:\nJoin date: {ctx.author.joined_at}\nAccount creation date: {ctx.author.created_at}\nAvatar URL: {ctx.author.avatar_url}") await ctx.channel.send(msg) else: - avamember = await bot.fetch_user(id) - msg = ( - f"{avamember.name} Info:\nJoin date: {avamember.joined_at}\nAccount creation date: {avamember.created_at}\nAvatar URL: {avamember.avatar_url}") + msg = (f"{avamember.name} Info:\nJoin date: {avamember.joined_at}\nAccount creation date: {avamember.created_at}\nAvatar URL: {avamember.avatar_url}") await ctx.channel.send(msg) - @bot.command() async def randnum(ctx, ran1, ran2, num): - r = requests.get( - f"https://www.random.org/integers/?num={num}&min={ran1}&max={ran2}&col=1&base=10&format=plain&rnd=new") + r = requests.get(f"https://www.random.org/integers/?num={num}&min={ran1}&max={ran2}&col=1&base=10&format=plain&rnd=new") randnumber = (r.text) msg = (f"```{randnumber}```") await ctx.send(msg) @@ -82,7 +79,7 @@ async def randnum(ctx, ran1, ran2, num): async def passgen(ctx, leng): if float(leng) > 1960: await ctx.send("too high, limit is `1950`") - + length = int(leng) alphabet = string.ascii_letters + string.digits @@ -97,22 +94,31 @@ async def passgen(ctx, leng): await ctx.send("Hit character limit.") await ctx.channel.send(msg) - @bot.command() async def lying(ctx, iss, pronoun): if pronoun == "she": - zerotwo = ( - "<@{0}> has me lying on my back. She's holding my legs in the air, and she's used an entire bottle of lube on her 8 inch cock. She slides her dino dick inside my winking, inviting asshole and starts thrusting into me. My moans of pleasure turn to shouts as she thrusts harder and harder inside me, slamming against my prostate. We look into each others' eyes, and she grabs my throbbing, erect penis and starts jacking me off while continuously thrusting her dinogirl penis deeper into my anal cavity. I can't take anymore and blast a gigantic load that hits my face, my eyes, my mouth, and my hair. Her thrusts get even faster and I feel my asshole start to overfill with her cum as she blasts a load into my anal cavity. She pulls her girlcock out of me and a river of dino semen starts to flow out of my asshole. She looks at my cum covered face and shoves her tongue down my throat and starts licking up the cum from my face.").format( - iss) + zerotwo = ("<@{0}> has me lying on my back. She's holding my legs in the air, and she's used an entire bottle of lube on her 8 inch cock. She slides her dino dick inside my winking, inviting asshole and starts thrusting into me. My moans of pleasure turn to shouts as she thrusts harder and harder inside me, slamming against my prostate. We look into each others' eyes, and she grabs my throbbing, erect penis and starts jacking me off while continuously thrusting her dinogirl penis deeper into my anal cavity. I can't take anymore and blast a gigantic load that hits my face, my eyes, my mouth, and my hair. Her thrusts get even faster and I feel my asshole start to overfill with her cum as she blasts a load into my anal cavity. She pulls her girlcock out of me and a river of dino semen starts to flow out of my asshole. She looks at my cum covered face and shoves her tongue down my throat and starts licking up the cum from my face.").format(iss) elif pronoun == "he": - zerotwo = ( - "<@{0}> has me lying on my back. He's holding my legs in the air, and he's used an entire bottle of lube on his 8 inch cock. He slides his dino dick inside my winking, inviting asshole and starts thrusting into me. My moans of pleasure turn to shouts as he thrusts harder and harder inside me, slamming against my prostate. We look into each others' eyes, and he grabs my throbbing, erect penis and starts jacking me off while continuously thrusting his dinogirl penis deeper into my anal cavity. I can't take anymore and blast a gigantic load that hits my face, my eyes, my mouth, and my hair. His thrusts get even faster and I feel my asshole start to overfill with his cum as he blasts a load into my anal cavity. He pulls his cock out of me and a river of dino semen starts to flow out of my asshole. He looks at my cum covered face and shoves his tongue down my throat and starts licking up the cum from my face.").format( - iss) + zerotwo = ("<@{0}> has me lying on my back. He's holding my legs in the air, and he's used an entire bottle of lube on his 8 inch cock. He slides his dino dick inside my winking, inviting asshole and starts thrusting into me. My moans of pleasure turn to shouts as he thrusts harder and harder inside me, slamming against my prostate. We look into each others' eyes, and he grabs my throbbing, erect penis and starts jacking me off while continuously thrusting his dinogirl penis deeper into my anal cavity. I can't take anymore and blast a gigantic load that hits my face, my eyes, my mouth, and my hair. His thrusts get even faster and I feel my asshole start to overfill with his cum as he blasts a load into my anal cavity. He pulls his cock out of me and a river of dino semen starts to flow out of my asshole. He looks at my cum covered face and shoves his tongue down my throat and starts licking up the cum from my face.").format(iss) else: await ctx.send("Invalid pronoun") print(iss) await ctx.send(zerotwo) +@bot.command() +async def randomwaifu(ctx): + base_url = 'http://randomwaifu.altervista.org/' + r = requests.get(base_url) + soup = bs.BeautifulSoup(r.text, "lxml") + for image_src in soup.find_all("img"): + image = (image_src['src']) + + name = soup.find('center').text + link = (f"http://randomwaifu.altervista.org/{image}") + embed1 = discord.Embed(color=0xc290c6) + embed1.add_field(name="Random waifu", value=f"{name}", inline=False) + embed1.set_image(url=f"{link}") + await ctx.send("btw this command sucks ass use %randomwaifu2 for better randomization", embed=embed1) @bot.command() async def aiwaifu(ctx): @@ -122,44 +128,46 @@ async def aiwaifu(ctx): embed1.set_image(url=f"{link}") await ctx.send(embed=embed1) - @bot.command() async def rate(ctx, *, inp): - rating = secrets.randbelow(100) - await ctx.channel.send(f"I rate `{inp}` a {rating}/100") - + if inp == "konata" or inp == "KONATA" or inp == "Konata": + await ctx.send(f"I rate `{inp}` a 55483095890483098549839058409386850497809590583290845983209580943860984509685490689053860984309584093859032850983209584309860943850698439064938056984309/100") + elif inp.lower() == "mako" or inp.lower() == "jose": + await ctx.send(f"I rate `{inp}` a ∞/100") + else: + rating = secrets.randbelow(100) + await ctx.channel.send(f"I rate `{inp}` a {rating}/100") @bot.command() -async def randomwaifu(ctx): +async def randomwaifu2(ctx): url = "https://www.random.org/integers/?num=1&min=1&max=104900&col=1&base=10&format=plain&rnd=new" q = requests.get(url) randnumbe = (q.text) randnumber = int(randnumbe) headers = { - 'User-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:80.0) Gecko/20100101 Firefox/80.0' + 'User-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:80.0) Gecko/20100101 Firefox/80.0' } url = (f"http://www.animecharactersdatabase.com/api_series_characters.php?character_id={randnumber}") r = requests.get(url, headers=headers) json_data = r.json() - charactername = (json_data["name"]) + charactername = (json_data["name"]) charactergender = (json_data["gender"]) characteranime = (json_data["origin"]) characterimage = (json_data["character_image"]) characterid = (json_data["id"]) - - embed1 = discord.Embed(title="Random waifu", color=0xc290c6) + + embed1=discord.Embed(title="Random waifu", color=0xc290c6) embed1.add_field(name="Name:", value=f"{charactername}", inline=False) embed1.add_field(name="Anime", value=f"{characteranime}", inline=False) embed1.add_field(name="Gender:", value=f"{charactergender}", inline=False) embed1.set_footer(text=f"Character ID: {characterid}") embed1.set_image(url=f"{characterimage}") await ctx.send(embed=embed1) - - +""" @bot.command() -async def screenshot(ctx, address, mode: str = None): +async def screenshot(ctx, address, mode : str = None): if ctx.author.id == ctx.author.id: if "https://nhentai.net" in address: await ctx.send("no :happytroll:") @@ -174,9 +182,8 @@ async def screenshot(ctx, address, mode: str = None): options.headless = True driver = webdriver.Firefox(options=options) driver.get(address) - S = lambda X: driver.execute_script('return document.body.parentNode.scroll' + X) - driver.set_window_size(S('Width'), S( - 'Height')) # May need manual adjustment + S = lambda X: driver.execute_script('return document.body.parentNode.scroll'+X) + driver.set_window_size(S('Width'),S('Height')) # May need manual adjustment driver.find_element_by_tag_name('body').screenshot(attachmentname) driver.quit() @@ -189,6 +196,7 @@ async def screenshot(ctx, address, mode: str = None): sleep(5) driver.get_screenshot_as_file(attachmentname) + await ctx.channel.send(message, file=discord.File(attachmentname)) os.remove(attachmentname) @@ -197,10 +205,9 @@ async def screenshot(ctx, address, mode: str = None): exc = (":boom: **Error** ```{0}```").format(x) await ctx.channel.send(exc) driver.quit() - - +""" async def approach(message): - await message.add_reaction("") + await message.add_reaction("") @bot.command() @@ -208,12 +215,11 @@ async def react(ctx, idd): msg = await ctx.channel.fetch_message(idd) await approach(msg) - def webhook(message, username, avatar, url): embed = { - "content": message, - "username": username, - "avatar_url": avatar + "content": message, + "username": username, + "avatar_url": avatar } result = requests.post(url, data=json.dumps(embed), headers={"Content-Type": "application/json"}) @@ -228,28 +234,24 @@ async def frame(ctx, id, *, message): except: pass avamember = await bot.fetch_user(id) - url = "https://discordapp.com/api/webhooks/" + url = "https://discord.com/api/webhooks//" name = (f'{avamember.name}') avatar = (f'{avamember.avatar_url}') msg = (f'"{message}"') webhook(message, name, avatar, url) - print( - f"INFO: Frame command ran: [{ctx.author.name}#{ctx.author.discriminator} Framed {avamember.name}#{avamember.discriminator} to say '{message}']") - + print(f"INFO: Frame command ran: [{ctx.author.name}#{ctx.author.discriminator} Framed {avamember.name}#{avamember.discriminator} to say '']") @bot.command() -async def webhooktransmit(ctx, link, username, avatar, content): +async def webhooktransmit(ctx, link, username, avatar, *, content): await ctx.message.delete() embed = { - "content": content, - "username": username, - "avatar_url": avatar + "content": content, + "username": username, + "avatar_url": avatar } result = requests.post(link, data=json.dumps(embed), headers={"Content-Type": "application/json"}) a = result.raise_for_status() await ctx.send(a) - - @bot.command() async def rename(ctx, *, name): if ctx.author.id in {133218314469113857}: @@ -257,12 +259,11 @@ async def rename(ctx, *, name): else: await ctx.send("bot owner only :////") - @bot.command() async def changeavatar(ctx): if ctx.author.id in {133218314469113857}: try: - + await ctx.send("ok") print("ok") urlll = (""'{}'"").format(ctx.message.attachments[0].url) @@ -270,7 +271,7 @@ async def changeavatar(ctx): print(urlll) print(urlllname) headers = { - 'User-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:80.0) Gecko/20100101 Firefox/80.0' + 'User-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:80.0) Gecko/20100101 Firefox/80.0' } r = requests.get(urlll, headers=headers, stream=True) @@ -288,8 +289,7 @@ async def changeavatar(ctx): except Exception as x: await ctx.channel.send(f"error...\n`{x}`") else: - await ctx.send("bot owner only :////") - + await ctx.send("bot owner only :////") @bot.command() async def activity(ctx, *, act): @@ -299,14 +299,12 @@ async def activity(ctx, *, act): else: await ctx.send("bot owner only :////") - @bot.command() async def yomama(ctx): - lines = open("yomama.txt").read().splitlines() + lines = open("dbs/yomama.txt").read().splitlines() joke = secrets.choice(lines) await ctx.send(f"{ctx.author.mention} {joke}") - @bot.command() async def ask(ctx, *, question): a = secrets.randbelow(2) @@ -316,42 +314,60 @@ async def ask(ctx, *, question): msg = (f"> {question}\n{ctx.author.mention} No") await ctx.send(msg) - @bot.command() -async def opinion(ctx, avamember: discord.User = None): +async def opinion(ctx, avamember : discord.User=None): a = secrets.randbelow(2) if a == 1: - await ctx.send( - f"{avamember.mention} https://tenor.com/view/ihate-you-anime-mad-ihate-you-so-fucking-much-gif-17124653") + await ctx.send(f"{avamember.mention} https://tenor.com/view/ihate-you-anime-mad-ihate-you-so-fucking-much-gif-17124653") else: await ctx.send(f"{avamember.mention} https://media.tenor.com/images/32ee226a0b4bd839f444fddbde231310/tenor.gif") - @bot.command() -async def randompasta(ctx): - with connection: - data = connection.execute("SELECT * FROM PASTAS ORDER BY RANDOM() LIMIT 1;") +async def randompasta(ctx, pastaid : str = None): + if pastaid == None: + with connection: + data = connection.execute("SELECT * FROM PASTAS ORDER BY RANDOM() LIMIT 1;") + for row in data: + a = (row[1]) + b = (row[0]) + await ctx.send(a) + await ctx.send(f"`{b}`") + else: + with connection: + data = connection.execute(f"SELECT * FROM PASTAS WHERE id LIKE '{pastaid}'") for row in data: a = (row[1]) b = (row[0]) await ctx.send(a) - await ctx.send(f"`{b}`") + await ctx.send(b) @bot.command() async def appendpasta(ctx, *, pasta): - if len(pasta) > 1968: - await ctx.send(f"Sorry, your copypasta is too long. the limit is `1968` (Yours was `{len(pasta)}`)") - return - authorid = (secrets.token_hex(8)) - formatting = (f"{pasta} **[Courtesy of {ctx.author.name}#{ctx.author.discriminator}]**\n") - sql = 'INSERT INTO PASTAS (id, content) values(?, ?)' - data = [ - (authorid, formatting), - ] + try: + if '@everyone' in pasta or '@here' in pasta: + await ctx.send("Illegal string detected, Ending...") + return + if len(pasta) > 1968: + await ctx.send(f"Sorry, your copypasta is too long. the limit is `1968` (Yours was `{len(pasta)}`)") + return + authorid = (secrets.token_hex(8)) + formatting = (f"{pasta} **[Courtesy of {ctx.author.name}#{ctx.author.discriminator}]**\n") + sql = 'INSERT INTO PASTAS (id, content) values(?, ?)' + data = [ + (authorid, formatting), + ] + with connection: + connection.executemany(sql, data) + await ctx.send(f"Successfully added your copypasta to the database with id `{authorid}`") + except Exception as x: + await ctx.send(f"Error: `{x}`") + +@bot.command() +async def pastastats(ctx): with connection: - connection.executemany(sql, data) - await ctx.send(f"Successfully added your copypasta to the database") - + data = connection.execute("SELECT COUNT(*) FROM PASTAS") + for count in data: + await ctx.send(f"Number of copypastas on file: `{count}`") @bot.command() async def deletepasta(ctx, pastaid): try: @@ -363,126 +379,92 @@ async def deletepasta(ctx, pastaid): await ctx.send("bot owner only!") except Exception as x: await ctx.send(f"Error: ```{x}```") - + @bot.command() -async def femboyrate(ctx, avamember: discord.User = None): +async def femboyrate(ctx, avamember : discord.User=None): a = randomnumbergen(0, 100) - msg = (f"{avamember.mention} is {a}% fe mb oy") + msg = (f"{avamember.mention} is {a}% femboy") await ctx.channel.send(msg) - @bot.command() -async def ship(ctx, avamember: discord.User = None, avamember2: discord.User = None): +async def ship(ctx, avamember : discord.User=None, avamember2 : discord.User=None): a = randomnumbergen(0, 100) print(a) print("ok") if a <= 10: - kokoro = ( - "[ :blue_heart: :black_heart: :black_heart: :black_heart: :black_heart: :black_heart: :black_heart: :black_heart: :black_heart: :black_heart: ]") + kokoro = ("[ :blue_heart: :black_heart: :black_heart: :black_heart: :black_heart: :black_heart: :black_heart: :black_heart: :black_heart: :black_heart: ]") elif a <= 20: - kokoro = ( - "[ :blue_heart: :blue_heart: :black_heart: :black_heart: :black_heart: :black_heart: :black_heart: :black_heart: :black_heart: :black_heart: ]") + kokoro = ("[ :blue_heart: :blue_heart: :black_heart: :black_heart: :black_heart: :black_heart: :black_heart: :black_heart: :black_heart: :black_heart: ]") elif a <= 30: - kokoro = ( - "[ :blue_heart: :blue_heart: :blue_heart: :black_heart: :black_heart: :black_heart: :black_heart: :black_heart: :black_heart: :black_heart: ]") + kokoro = ("[ :blue_heart: :blue_heart: :blue_heart: :black_heart: :black_heart: :black_heart: :black_heart: :black_heart: :black_heart: :black_heart: ]") elif a <= 40: - kokoro = ( - "[ :blue_heart: :blue_heart: :blue_heart: :blue_heart: :black_heart: :black_heart: :black_heart: :black_heart: :black_heart: :black_heart: ]") + kokoro = ("[ :blue_heart: :blue_heart: :blue_heart: :blue_heart: :black_heart: :black_heart: :black_heart: :black_heart: :black_heart: :black_heart: ]") elif a <= 50: - kokoro = ( - "[ :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :black_heart: :black_heart: :black_heart: :black_heart: :black_heart: ]") + kokoro = ("[ :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :black_heart: :black_heart: :black_heart: :black_heart: :black_heart: ]") elif a <= 60: - kokoro = ( - "[ :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :black_heart: :black_heart: :black_heart: :black_heart: ]") + kokoro = ("[ :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :black_heart: :black_heart: :black_heart: :black_heart: ]") elif a <= 70: - kokoro = ( - "[ :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :black_heart: :black_heart: :black_heart: ]") + kokoro = ("[ :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :black_heart: :black_heart: :black_heart: ]") elif a <= 80: - kokoro = ( - "[ :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :black_heart: :black_heart: ]") + kokoro = ("[ :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :black_heart: :black_heart: ]") elif a <= 90: - kokoro = ( - "[ :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :black_heart: ]") + kokoro = ("[ :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :black_heart: ]") elif a <= 100: - kokoro = ( - "[ :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: ]") + kokoro = ("[ :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: ]") if avamember.id in {133218314469113857} and avamember2.id in {397928612906532865}: - msg = ( - f"Person 1: {avamember.mention}\nPerson 2: {avamember2.mention}\nRating: [ :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: ] (59864561561561564651561890565914685534653412343542345374534534254534545324153%)") + msg = (f"Person 1: {avamember.mention}\nPerson 2: {avamember2.mention}\nRating: [ :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: :blue_heart: ] (59864561561561564651561890565914685534653412343542345374534534254534545324153%)") else: msg = (f"Person 1: {avamember.mention}\nPerson 2: {avamember2.mention}\nRating: {kokoro} ({a}%)") await ctx.send(msg) - @bot.command() -async def threesomeship(ctx, avamember: discord.User = None, avamember2: discord.User = None, - avamember3: discord.User = None): +async def threesomeship(ctx, avamember : discord.User=None, avamember2 : discord.User=None, avamember3 : discord.User=None): a = randomnumbergen(0, 100) print(a) print("ok") if a <= 10: - kokoro = ( - "[ :green_heart: :black_heart: :black_heart: :black_heart: :black_heart: :black_heart: :black_heart: :black_heart: :black_heart: :black_heart: ]") + kokoro = ("[ :green_heart: :black_heart: :black_heart: :black_heart: :black_heart: :black_heart: :black_heart: :black_heart: :black_heart: :black_heart: ]") elif a <= 20: - kokoro = ( - "[ :green_heart: :green_heart: :black_heart: :black_heart: :black_heart: :black_heart: :black_heart: :black_heart: :black_heart: :black_heart: ]") + kokoro = ("[ :green_heart: :green_heart: :black_heart: :black_heart: :black_heart: :black_heart: :black_heart: :black_heart: :black_heart: :black_heart: ]") elif a <= 30: - kokoro = ( - "[ :green_heart: :green_heart: :green_heart: :black_heart: :black_heart: :black_heart: :black_heart: :black_heart: :black_heart: :black_heart: ]") + kokoro = ("[ :green_heart: :green_heart: :green_heart: :black_heart: :black_heart: :black_heart: :black_heart: :black_heart: :black_heart: :black_heart: ]") elif a <= 40: - kokoro = ( - "[ :green_heart: :green_heart: :green_heart: :green_heart: :black_heart: :black_heart: :black_heart: :black_heart: :black_heart: :black_heart: ]") + kokoro = ("[ :green_heart: :green_heart: :green_heart: :green_heart: :black_heart: :black_heart: :black_heart: :black_heart: :black_heart: :black_heart: ]") elif a <= 50: - kokoro = ( - "[ :green_heart: :green_heart: :green_heart: :green_heart: :green_heart: :black_heart: :black_heart: :black_heart: :black_heart: :black_heart: ]") + kokoro = ("[ :green_heart: :green_heart: :green_heart: :green_heart: :green_heart: :black_heart: :black_heart: :black_heart: :black_heart: :black_heart: ]") elif a <= 60: - kokoro = ( - "[ :green_heart: :green_heart: :green_heart: :green_heart: :green_heart: :green_heart: :black_heart: :black_heart: :black_heart: :black_heart: ]") + kokoro = ("[ :green_heart: :green_heart: :green_heart: :green_heart: :green_heart: :green_heart: :black_heart: :black_heart: :black_heart: :black_heart: ]") elif a <= 70: - kokoro = ( - "[ :green_heart: :green_heart: :green_heart: :green_heart: :green_heart: :green_heart: :green_heart: :black_heart: :black_heart: :black_heart: ]") + kokoro = ("[ :green_heart: :green_heart: :green_heart: :green_heart: :green_heart: :green_heart: :green_heart: :black_heart: :black_heart: :black_heart: ]") elif a <= 80: - kokoro = ( - "[ :green_heart: :green_heart: :green_heart: :green_heart: :green_heart: :green_heart: :green_heart: :green_heart: :black_heart: :black_heart: ]") + kokoro = ("[ :green_heart: :green_heart: :green_heart: :green_heart: :green_heart: :green_heart: :green_heart: :green_heart: :black_heart: :black_heart: ]") elif a <= 90: - kokoro = ( - "[ :green_heart: :green_heart: :green_heart: :green_heart: :green_heart: :green_heart: :green_heart: :green_heart: :green_heart: :black_heart: ]") + kokoro = ("[ :green_heart: :green_heart: :green_heart: :green_heart: :green_heart: :green_heart: :green_heart: :green_heart: :green_heart: :black_heart: ]") elif a <= 100: - kokoro = ( - "[ :green_heart: :green_heart: :green_heart: :green_heart: :green_heart: :green_heart: :green_heart: :green_heart: :green_heart: :green_heart: :green_heart: ]") - msg = ( - f"Person 1: {avamember.mention}\nPerson 2: {avamember2.mention}\nPerson 3: {avamember3.mention}\nRating: {kokoro} ({a}%)") + kokoro = ("[ :green_heart: :green_heart: :green_heart: :green_heart: :green_heart: :green_heart: :green_heart: :green_heart: :green_heart: :green_heart: :green_heart: ]") + msg = (f"Person 1: {avamember.mention}\nPerson 2: {avamember2.mention}\nPerson 3: {avamember3.mention}\nRating: {kokoro} ({a}%)") await ctx.send(msg) - @bot.command() -async def orgyship(ctx, avamember: discord.User = None, avamember2: discord.User = None, - avamember3: discord.User = None, avamember4: discord.User = None, avamember5: discord.User = None): +async def orgyship(ctx, avamember : discord.User=None, avamember2 : discord.User=None, avamember3 : discord.User=None, avamember4 : discord.User=None, avamember5 : discord.User=None): a = randomnumbergen(0, 100) print(a) print("ok") if a <= 10: - kokoro = ( - "[ :heart: :black_heart: :black_heart: :black_heart: :black_heart: :black_heart: :black_heart: :black_heart: :black_heart: :black_heart: ]") + kokoro = ("[ :heart: :black_heart: :black_heart: :black_heart: :black_heart: :black_heart: :black_heart: :black_heart: :black_heart: :black_heart: ]") elif a <= 20: - kokoro = ( - "[ :heart: :heart: :black_heart: :black_heart: :black_heart: :black_heart: :black_heart: :black_heart: :black_heart: :black_heart: ]") + kokoro = ("[ :heart: :heart: :black_heart: :black_heart: :black_heart: :black_heart: :black_heart: :black_heart: :black_heart: :black_heart: ]") elif a <= 30: - kokoro = ( - "[ :heart: :heart: :heart: :black_heart: :black_heart: :black_heart: :black_heart: :black_heart: :black_heart: :black_heart: ]") + kokoro = ("[ :heart: :heart: :heart: :black_heart: :black_heart: :black_heart: :black_heart: :black_heart: :black_heart: :black_heart: ]") elif a <= 40: - kokoro = ( - "[ :heart: :heart: :heart: :heart: :black_heart: :black_heart: :black_heart: :black_heart: :black_heart: :black_heart: ]") + kokoro = ("[ :heart: :heart: :heart: :heart: :black_heart: :black_heart: :black_heart: :black_heart: :black_heart: :black_heart: ]") elif a <= 50: - kokoro = ( - "[ :heart: :heart: :heart: :heart: :heart: :black_heart: :black_heart: :black_heart: :black_heart: :black_heart: ]") + kokoro = ("[ :heart: :heart: :heart: :heart: :heart: :black_heart: :black_heart: :black_heart: :black_heart: :black_heart: ]") elif a <= 60: - kokoro = ( - "[ :heart: :heart: :heart: :heart: :heart: :heart: :black_heart: :black_heart: :black_heart: :black_heart: ]") + kokoro = ("[ :heart: :heart: :heart: :heart: :heart: :heart: :black_heart: :black_heart: :black_heart: :black_heart: ]") elif a <= 70: - kokoro = ( - "[ :heart: :heart: :heart: :heart: :heart: :heart: :heart: :black_heart: :black_heart: :black_heart: ]") + kokoro = ("[ :heart: :heart: :heart: :heart: :heart: :heart: :heart: :black_heart: :black_heart: :black_heart: ]") elif a <= 80: kokoro = ("[ :heart: :heart: :heart: :heart: :heart: :heart: :heart: :heart: :black_heart: :black_heart: ]") elif a <= 90: @@ -490,16 +472,13 @@ async def orgyship(ctx, avamember: discord.User = None, avamember2: discord.User elif a <= 100: kokoro = ("[ :heart: :heart: :heart: :heart: :heart: :heart: :heart: :heart: :heart: :heart: :heart: ]") kokorofunny = ("[ :heart: :heart: :heart: :heart: :heart: :heart: :heart: :heart: :heart: :heart: :heart: ]") - if avamember.id in {338474093743439872} and avamember2.id in {397928612906532865} and avamember3.id in { - 658342427546877994} and avamember4.id in {133218314469113857} and avamember5.id in {389850804607254528}: - msg = ( - f"Person 1: {avamember.mention}\nPerson 2: {avamember2.mention}\nPerson 3: {avamember3.mention}\nPerson 4: {avamember4.mention}\nPerson 5: {avamember5.mention}\nRating: {kokorofunny} (100%)") + if avamember.id in {338474093743439872} and avamember2.id in {397928612906532865} and avamember3.id in {658342427546877994} and avamember4.id in {133218314469113857} and avamember5.id in {389850804607254528}: + msg = (f"Person 1: {avamember.mention}\nPerson 2: {avamember2.mention}\nPerson 3: {avamember3.mention}\nPerson 4: {avamember4.mention}\nPerson 5: {avamember5.mention}\nRating: {kokorofunny} (100%)") else: - msg = ( - f"Person 1: {avamember.mention}\nPerson 2: {avamember2.mention}\nPerson 3: {avamember3.mention}\nPerson 4: {avamember4.mention}\nPerson 5: {avamember5.mention}\nRating: {kokoro} ({a}%)") + msg = (f"Person 1: {avamember.mention}\nPerson 2: {avamember2.mention}\nPerson 3: {avamember3.mention}\nPerson 4: {avamember4.mention}\nPerson 5: {avamember5.mention}\nRating: {kokoro} ({a}%)") await ctx.send(msg) - + @bot.command() async def convert(ctx, num, type, type2): if type == "days": @@ -509,9 +488,10 @@ async def convert(ctx, num, type, type2): if type2 == "seconds": a = int(num) * 3600 - @bot.command() async def bmi(ctx, kg, cm): + + try: height = float(cm) weight = float(kg) @@ -522,7 +502,7 @@ async def bmi(ctx, kg, cm): a = ("wtf") elif (bmi < 16): - a = ("severely underweight (((((are you a femboy???))))) :warning:") + a = ("severely underweight (((((femboy))))) :warning:") elif (bmi >= 16 and bmi < 18.5): a = ("underweight :information_source:") @@ -533,31 +513,36 @@ async def bmi(ctx, kg, cm): elif (bmi >= 26 and bmi < 30): a = ("overweight :warning:") - elif (bmi >= 30): + elif (bmi >= 30 and bmi < 50): a = ("severely overweight :warning:") - + + elif (bmi >= 50): + a = ("fatass lol") + + await ctx.send(f"Your BMI is `{bmi}` and you are\n{a}") except Exception as x: await ctx.send(f"an error occured\n```{x}```") - @bot.command() async def say(ctx, *, what): if "@everyone" in ctx.message.content or "@here" in ctx.message.content: await ctx.send("everyone/here ping detected, aborting...") else: - await ctx.message.delete() + try: + await ctx.message.delete() + except: + pass await ctx.send(what) - @bot.command() -async def avatar(ctx, avamember: discord.User = None): +async def avatar(ctx, avamember : discord.User=None): msg = (f"`{avamember.name}#{avamember.discriminator}'s avatar is` {avamember.avatar_url}") await ctx.send(msg) - @bot.command() async def dict(ctx, *, word): + try: dictionary = PyDictionary() a = (dictionary.meaning(word)) @@ -566,7 +551,6 @@ async def dict(ctx, *, word): except Exception as x: await ctx.send(f"an error occured:\n```{x}```") - @bot.command() async def wordcloud(ctx, range): await ctx.send(f"ok generating wordcloud for {range} message, please wait (this may take a while)") @@ -581,12 +565,11 @@ async def wordcloud(ctx, range): await ctx.send("successfully generated", file=discord.File("wordcloud.png")) os.remove("channel_messages.txt") os.remove("wordcloud.png") - - + @bot.command() async def iplocation(ctx, ip): try: - url = f"https://api.ipgeolocation.io/ipgeo?apiKey=&ip={ip}" + url = f"https://api.ipgeolocation.io/ipgeo?apiKey=?????????????????????????&ip={ip}" headers = {'User-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:80.0) Gecko/20100101 Firefox/80.0'} r = requests.get(url, headers=headers) s = r.json() @@ -605,7 +588,7 @@ async def iplocation(ctx, ip): organization = (s['organization']) flag = (s['country_flag']) - embed = discord.Embed(title="IPInfo", color=0x2d3dff) + embed=discord.Embed(title="IPInfo", color=0x2d3dff) embed.set_thumbnail(url=flag) embed.add_field(name="IP", value=ip, inline=True) embed.add_field(name="Continent", value=continent, inline=True) @@ -617,52 +600,72 @@ async def iplocation(ctx, ip): embed.add_field(name="Organization", value=organization, inline=True) embed.add_field(name="Is EU", value=eu, inline=True) embed.add_field(name="Calling code", value=callingcode, inline=True) - + await ctx.send(embed=embed) except Exception as x: await ctx.send(f"An error occured\n```{x}```") - - + @bot.command() -async def img(ctx, *, term): +async def request(ctx, address): + try: + headers = {'User-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:80.0) Gecko/20100101 Firefox/80.0'} + r = requests.get(address, headers=headers) + s = r.json() + + await ctx.send(f"```{s}```") + except Exception as x: + await ctx.send(x) + +@bot.command() +async def img(ctx, term, num : str = 1): # anti ewmx - blacklist = ['genshin', 'amber', 'impact'] + + if ctx.author.id in {564989354701233675}: + await ctx.send("我真的很喜欢Genshin Impact 这是一个因喜剧效果而产生的模因。我不支持 Glorious Leader Xi Jinping 或他作为总统的举动。我现在将继续使用随机术语来使这个变得有趣。\n大块头大块头大男孩东方传说习近平 1989 Massacre 全能大主习近平主席永恒 The Xinjiang Uyghur Autonomous Region 赞美加贝·纽维尔勋爵为反击和保卫古人 Kung-Flu 成吉思汗没做错事,习近平国王绝杀了传说中的故事 The Great Leap Forward") + return + blacklist = ['genshifdsfdsn', 'afddsmber', 'ifdsfdsmpact', 'pafdsfdsimon', 'fdsfdsfds', 'ambdfsfdsar'] for t in blacklist: - if t in term.lower(): await ctx.send("我真的很喜欢Genshin Impact 这是一个因喜剧效果而产生的模因。我不支持 Glorious Leader Xi Jinping 或他作为总统的举动。我现在将继续使用随机术语来使这个变得有趣。\n大块头大块头大男孩东方传说习近平 1989 Massacre 全能大主习近平主席永恒 The Xinjiang Uyghur Autonomous Region 赞美加贝·纽维尔勋爵为反击和保卫古人 Kung-Flu 成吉思汗没做错事,习近平国王绝杀了传说中的故事 The Great Leap Forward") return - + # calv funny + if "calv car" in term.lower(): + await ctx.send("https://cdn.discordapp.com/attachments/769023126507356163/775757570542665749/femboy_whip.png") + return # normal use case - a = await ctx.send("Contacting API <:load:757718569978036314>") - - gis = GoogleImagesSearch('', ' - :wilie2bh9p4') - _search_params = { + a = await ctx.send("Contacting API ") + try: + b = int(num) + + gis = GoogleImagesSearch('???????????????????????????', '???????????????????????????????????') + _search_params = { 'q': term, - 'num': 1, + 'num': b, 'safe': 'off', - } - - gis.search(search_params=_search_params) - for image in gis.results(): - global url - url = (image.url) - - embed1 = discord.Embed(title="Image search result", description=f"`{term}`", color=0x0000ff) - embed1.set_image(url=f"{url}") - embed1.set_footer(text=f"Page 1") - - await a.delete() - - await ctx.send(embed=embed1) - + } + + + gis.search(search_params=_search_params) + for image in gis.results(): + global url + url = (image.url) + + embed1 = discord.Embed(title="Click here for full image", url=url, description=f"`{term}`", color=0x0000ff) + embed1.set_image(url=f"{url}") + embed1.set_footer(icon_url=f"{ctx.author.avatar_url}", text=f"Page {b}\nRequested by {ctx.author.name}#{ctx.author.discriminator}") + + await a.delete() + + await ctx.send(embed=embed1) + except Exception as x: + await ctx.send(f"`{x}`") + @bot.command() async def osu(ctx, action, *, inp): if action == "user": try: - url = f"https://osu.ppy.sh/api/get_user?u={inp}&k=" + url = f"https://osu.ppy.sh/api/get_user?u={inp}&k=????????????????????????????????" headers = { 'User-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:80.0) Gecko/20100101 Firefox/80.0' } @@ -683,15 +686,14 @@ async def osu(ctx, action, *, inp): pp_country_rank = (s[0]['pp_country_rank']) playcount = (s[0]['playcount']) pp_raw = (s[0]['pp_raw']) - + lowercountry = (country.lower()) - + icon_url = f"http://s.ppy.sh/a/{user_id}" time = int(total_seconds_played) / 3600 - embed = discord.Embed(title="User search", description=username) - embed.set_author(name="Osu!", - icon_url="https://upload.wikimedia.org/wikipedia/commons/thumb/d/d3/Osu%21Logo_%282015%29.png/600px-Osu%21Logo_%282015%29.png") + embed=discord.Embed(title="User search", description=username) + embed.set_author(name="Osu!", icon_url="https://upload.wikimedia.org/wikipedia/commons/thumb/d/d3/Osu%21Logo_%282015%29.png/600px-Osu%21Logo_%282015%29.png") embed.set_thumbnail(url=icon_url) embed.add_field(name="User ID", value=user_id, inline=True) embed.add_field(name="Username", value=username, inline=True) @@ -701,8 +703,7 @@ async def osu(ctx, action, *, inp): embed.add_field(name="PP Rank", value=pp_rank, inline=True) embed.add_field(name="Accuracy", value=accuracy, inline=True) embed.add_field(name="Count rank SS", value=count_rank_ss, inline=True) - embed.add_field(name="Total seconds played", value=f"{total_seconds_played} ({round(time)} hours)", - inline=True) + embed.add_field(name="Total seconds played", value=f"{total_seconds_played} ({round(time)} hours)", inline=True) embed.add_field(name="Country", value=f"{country} :flag_{lowercountry}:", inline=True) embed.add_field(name="PP Country rank", value=pp_country_rank, inline=True) embed.add_field(name="Raw PP", value=pp_raw, inline=True) @@ -711,14 +712,16 @@ async def osu(ctx, action, *, inp): await ctx.send(embed=embed) except Exception as x: await ctx.send(f"An error occured ```{x}```") - + elif action == "beatmap" or action == "map": try: - url = f"https://osu.ppy.sh/api/get_beatmaps?b={inp}&k=" + url = f"https://osu.ppy.sh/api/get_beatmaps?b={inp}&k=???????????????????????????" headers = { 'User-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:80.0) Gecko/20100101 Firefox/80.0' } + + r = requests.get(url, headers=headers) s = r.json() @@ -747,9 +750,8 @@ async def osu(ctx, action, *, inp): cover = f"https://assets.ppy.sh/beatmaps/{beatmap_id}/covers/cover.jpg" thumb = f"https://b.ppy.sh/thumb/{beatmap_id}l.jpg" - embed = discord.Embed(title="Beatmap search", description="5456156") - embed.set_author(name="Osu!", - icon_url="https://upload.wikimedia.org/wikipedia/commons/thumb/d/d3/Osu%21Logo_%282015%29.png/600px-Osu%21Logo_%282015%29.png") + embed=discord.Embed(title="Beatmap search", description="5456156") + embed.set_author(name="Osu!", icon_url="https://upload.wikimedia.org/wikipedia/commons/thumb/d/d3/Osu%21Logo_%282015%29.png/600px-Osu%21Logo_%282015%29.png") embed.set_thumbnail(url=thumb) embed.add_field(name="Beatmap ID", value=beatmap_id, inline=True) embed.add_field(name="Approved", value=approved, inline=True) @@ -777,20 +779,18 @@ async def osu(ctx, action, *, inp): await ctx.send(embed=embed) except Exception as x: await ctx.send(f"An error occured ```{x}```") - - + @bot.command() async def tempconvert(ctx, unit, inp): if unit == "c" or unit == "celsius": a = int(inp) - converted = (a * 9 / 5) + 32 + converted = (a * 9/5) + 32 await ctx.send(f"**{inp}°C** Is equal to **{converted}°F**") elif unit == "f" or unit == "fahrenheit": a = int(inp) - converted = (a - 32) * 5 / 9 + converted = (a - 32) * 5/9 await ctx.send(f"**{inp}°F** Is equal to **{converted}°C**") - - + @bot.command() async def speedconvert(ctx, unit, number): if unit == "mph" or unit == "miles": @@ -801,8 +801,7 @@ async def speedconvert(ctx, unit, number): a = int(number) converted = a * 1.609 await ctx.send(f"**{number} Mph** is equal to approximately **{converted} Km/h**") - - + @bot.command() async def weightconvert(ctx, unit, number): if unit == "kg": @@ -813,8 +812,7 @@ async def weightconvert(ctx, unit, number): a = int(number) converted = a * 2.205 await ctx.send(f"**{number} Kg** is equal to **{converted} Pounds**") - - + @bot.command() async def delete(ctx, msgid): if ctx.author.id in {133218314469113857}: @@ -824,8 +822,7 @@ async def delete(ctx, msgid): await ctx.send(f"Deleted `{msgid}`") else: await ctx.send("bot owner only :///") - - + @bot.command() async def urban(ctx, *, word): try: @@ -840,87 +837,93 @@ async def urban(ctx, *, word): definition = (s['list'][0]['definition']) example = (s['list'][0]['example']) - defformatted = definition.replace("[", "") - defformatted2 = defformatted.replace("]", "") + v1 = definition.replace("[", "") + v2 = v1.replace("]", "") + v3 = v2.replace('\\n', '\n').replace('\\t', '\t')[:1024] + exampleformatted = example.replace("[", "") exampleformatted2 = exampleformatted.replace("]", "") - embed = discord.Embed(title=word) + + embed=discord.Embed(title=word) embed.set_author(name="Urban Dictionary", icon_url="https://img.utdstc.com/icons/urban-dictionary-android.png") embed.set_thumbnail(url="https://img.utdstc.com/icons/urban-dictionary-android.png") - embed.add_field(name="Definition", value=defformatted2, inline=True) + embed.add_field(name="Definition", value=v3, inline=True) embed.add_field(name="Example", value=exampleformatted2, inline=True) await ctx.send(embed=embed) + if len(v2) > 1028: + await ctx.send("`Definition has been cut to comply with the message length limit`") except Exception as x: await ctx.send(f"An error occured ```{x}```") - - + @bot.command() -async def ping(ctx): - ping = subprocess.Popen( - ["ping", "-c", "1", "google.com"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE - ) - out, error = ping.communicate() - await ctx.send(out) - - +async def imagesearch(ctx, provider, url : str = None): + if provider == "google": + if url == None: + img = ctx.message.attachments[0].url + msg = f"https://www.google.com/searchbyimage?&image_url={img}" + await ctx.send(msg) + else: + msg = f"https://www.google.com/searchbyimage?&image_url={url}" + await ctx.send(msg) + @bot.command() async def typing(ctx): await ctx.message.delete() async with ctx.typing(): sleep(25) - @bot.command() async def pocky(ctx, person, person2): + inp1spaces = person.replace("-", " ") inp2spaces = person2.replace("-", " ") try: await ctx.message.delete() except: pass - image = Image.open('pockytemplate.png') + image = Image.open('resources/templates/pockytemplate.png') draw = ImageDraw.Draw(image) - - font = ImageFont.truetype('Prototype.ttf', size=45) - + + font = ImageFont.truetype('resources/Prototype.ttf', size=45) + (x, y) = (50, 50) message = inp1spaces - color = 'rgb(0, 0, 0)' # black color - + color = 'rgb(0, 0, 0)' # black color + draw.text((x, y), message, fill=color, font=font) + (x, y) = (380, 97) message = inp2spaces - color = 'rgb(0, 0, 0)' # black color - + color = 'rgb(0, 0, 0)' # black color + draw.text((x, y), message, fill=color, font=font) + image.save('pocky.png') await ctx.send(file=discord.File("pocky.png")) os.remove("pocky.png") - - + @bot.command() async def translate(ctx, fro, to, *, inputt): - translator = Translator(from_lang=fro, to_lang=to) + translator= Translator(from_lang=fro, to_lang=to) translation = translator.translate(inputt) message = ("Translation from `{0}` to `{1}`\n```{2}```").format(fro, to, translation) await ctx.channel.send(message) +""" will eventually fix @bot.command() -async def whatanime(ctx, url: str = None): +async def whatanime(ctx, url : str = None): try: if not ctx.message.attachments: await ctx.channel.send("Searching...") videoname = ('GFS-ANIME_{0}.mp4').format(ctx.message.id) tracemoe = tracemoepy.tracemoe.TraceMoe() link = ('{0}').format(url) - output = tracemoe.search(link, is_url=True) + output = tracemoe.search(link, is_url = True) video = tracemoe.video_preview(output) with open(videoname, 'wb') as f: f.write(video) @@ -933,24 +936,18 @@ async def whatanime(ctx, url: str = None): similarity = (f"**Similarity**: {str(result['similarity'])[2]}") adult = (f"{result['is_adult']}") at = (f"**Timestamp**: {str(result['from'])[1]}") - msg = ("{0}\n{1} | {6}\n{2}\n{3}\n{4} minutes\n{5}").format(title, ogtitle, year, Episode, at, similarity, - romaji) - + msg = ("{0}\n{1} | {6}\n{2}\n{3}\n{4} minutes\n{5}").format(title, ogtitle, year, Episode, at, similarity, romaji) if adult == "True": if ctx.channel.is_nsfw(): await ctx.channel.send(msg, file=discord.File(videoname)) os.remove(videoname) else: - await ctx.channel.send( - "Can't send NSFW Result in SFW Channel! (Try running the command in an NSFW channel)") + await ctx.channel.send("Can't send NSFW Result in SFW Channel! (Try running the command in an NSFW channel)") os.remove(videoname) elif adult == "False": await ctx.channel.send(msg, file=discord.File(videoname)) else: await ctx.channel.send("An error occured, Please try again.") - - - else: await ctx.channel.send("Searching...") attachmenturl = (""'{}'"").format(ctx.message.attachments[0].url) @@ -959,7 +956,7 @@ async def whatanime(ctx, url: str = None): videoname = ('GFS-ANIME_{0}.mp4').format(ctx.message.id) headers = { - 'User-agent': 'Mozilla/5.0 (Windows NT 6.3; rv:36.0) Gecko/20100101 Firefox/36.0' + 'User-agent': 'Mozilla/5.0 (Windows NT 6.3; rv:36.0) Gecko/20100101 Firefox/36.0' } r = requests.get(attachmenturl, headers=headers, stream=True) with open(attachmentname, 'wb') as out_file: @@ -972,34 +969,43 @@ async def whatanime(ctx, url: str = None): video = tracemoe.video_preview(output) result = output['docs'][0] - title = f"**Title**: {result['title_english']}" - ogtitle = f"**Original Title**: {result['title_native']}" - romaji = f"{result['title_romaji']}" - year = f"**Year**: {result['season']}" - Episode = f"**Episode**: {result['episode']}" - similarity = f"**Similarity**: {str(result['similarity'])[2]}" - adult = f"{result['is_adult']}" - at = f"**Timestamp**: {str(result['from'])[1]}" - msg = "{0}\n{1} | {6}\n{2}\n{3}\n{4} minutes\n{5}".format(title, ogtitle, year, Episode, at, similarity, - romaji) + title = (f"**Title**: {result['title_english']}") + ogtitle = (f"**Original Title**: {result['title_native']}") + romaji = (f"{result['title_romaji']}") + year = (f"**Year**: {result['season']}") + Episode = (f"**Episode**: {result['episode']}") + similarity = (f"**Similarity**: {str(result['similarity'])[2]}") + adult = (f"{result['is_adult']}") + at = (f"**Timestamp**: {str(result['from'])[1]}") + + j_anilist_id = (result['anilist_id']) + j_filename = (result['filename']) + j_at = (result['at']) + j_tokenthumb = (result['tokenthumb']) + + prev0 = f"https://media.trace.moe/video/{j_anilist_id}/{j_filename}?t={j_at}&token={j_tokenthumb}" + prev = prev0.replace(" ", "%20") + print(prev) + print(prev0) + msg = ("{0}\n{1} | {6}\n{2}\n{3}\n{4} minutes\n{5}\n\nPreview:\n{6}").format(title, ogtitle, year, Episode, at, similarity, romaji, prev) if adult == "True": if ctx.channel.is_nsfw(): await ctx.channel.send(msg) - await ctx.send(video) + await ctx.send(prev) else: - await ctx.channel.send( - "Can't send NSFW Result in SFW Channel! (Try running the command in an NSFW channel)") + await ctx.channel.send("Can't send NSFW Result in SFW Channel! (Try running the command in an NSFW channel)") elif adult == "False": await ctx.channel.send(msg) - await ctx.send(video) + await ctx.send(prev) + else: await ctx.channel.send("An error occured, Please try again.") except Exception as x: print(x) exc = (":boom: **Error**```{0}```").format(x) await ctx.channel.send(exc) - +""" @bot.command() async def servers(ctx): @@ -1008,69 +1014,71 @@ async def servers(ctx): for name in bot.guilds: b += f"{name}\n" await ctx.send(f"Bot is in {a} servers.\n```{b}```") - -# This part of the code is for the 2 person image reactions -# The paths may be incorrect -# Update them accordingly when self hosting this bot - + @bot.command() async def hugging(ctx, person, person2): + inp1spaces = person.replace("-", " ") inp2spaces = person2.replace("-", " ") try: await ctx.message.delete() except: pass - image = Image.open('hugtemplate.png') + image = Image.open('resources/templates/hugtemplate.png') draw = ImageDraw.Draw(image) - - font = ImageFont.truetype('Prototype.ttf', size=45) - + + font = ImageFont.truetype('resources/Prototype.ttf', size=45) + (x, y) = (182, 262) message = inp1spaces - color = 'rgb(0, 0, 0)' # black color - + color = 'rgb(0, 0, 0)' # black color + draw.text((x, y), message, fill=color, font=font) + (x, y) = (433, 555) message = inp2spaces - color = 'rgb(0, 0, 0)' # black color - + color = 'rgb(0, 0, 0)' # black color + draw.text((x, y), message, fill=color, font=font) + image.save('hug.png') await ctx.send(file=discord.File("hug.png")) os.remove("hug.png") - - + @bot.command() async def kissing(ctx, person, person2): + inp1spaces = person.replace("-", " ") inp2spaces = person2.replace("-", " ") try: await ctx.message.delete() except: pass - image = Image.open('kisstemplate.jpg') + image = Image.open('resources/templates/kisstemplate.jpg') draw = ImageDraw.Draw(image) - - font = ImageFont.truetype('Prototype.ttf', size=45) - + + font = ImageFont.truetype('resources/Prototype.ttf', size=45) + (x, y) = (420, 288) message = inp1spaces - color = 'rgb(255, 255, 255)' # white color - + color = 'rgb(255, 255, 255)' # white color + draw.text((x, y), message, fill=color, font=font) + (x, y) = (589, 316) message = inp2spaces - color = 'rgb(255, 255, 255)' # white color - + color = 'rgb(255, 255, 255)' # white color + draw.text((x, y), message, fill=color, font=font) + image.save('kiss.png') await ctx.send(file=discord.File("kiss.png")) os.remove("kiss.png") + @bot.command() async def drinking(ctx, person, person2): @@ -1080,28 +1088,28 @@ async def drinking(ctx, person, person2): await ctx.message.delete() except: pass - image = Image.open('drinktemplate.png') + image = Image.open('resources/templates/drinktemplate.png') draw = ImageDraw.Draw(image) - font = ImageFont.truetype('Prototype.ttf', size=45) + font = ImageFont.truetype('resources/Prototype.ttf', size=45) (x, y) = (157, 263) message = inp1spaces - color = 'rgb(255, 0, 0)' # red color + color = 'rgb(255, 0, 0)' # black color draw.text((x, y), message, fill=color, font=font) (x, y) = (485, 227) message = inp2spaces - color = 'rgb(255, 0, 0)' # red color + color = 'rgb(255, 0, 0)' # black color draw.text((x, y), message, fill=color, font=font) image.save('drink.png') await ctx.send(file=discord.File("drink.png")) os.remove("drink.png") - - + + @bot.command() async def shinji(ctx, person, person2): inp1spaces = person.replace("-", " ") @@ -1110,10 +1118,10 @@ async def shinji(ctx, person, person2): await ctx.message.delete() except: pass - image = Image.open('shinjitemplate.png') + image = Image.open('resources/templates/shinjitemplate.png') draw = ImageDraw.Draw(image) - font = ImageFont.truetype('Prototype.ttf', size=45) + font = ImageFont.truetype('resources/Prototype.ttf', size=45) (x, y) = (157, 252) message = inp1spaces @@ -1130,17 +1138,8 @@ async def shinji(ctx, person, person2): image.save('shinji.png') await ctx.send(file=discord.File("shinji.png")) os.remove("shinji.png") - - - -@bot.command() -async def repeat(ctx, num, *, content): - if num > 5: - await ctx.send("maximum number of repeats is 5.") - else: - for i in range(num): - await ctx.send(content) - + + @bot.command() async def duckduckgo(ctx, term, num : int = 0): try: @@ -1154,83 +1153,102 @@ async def duckduckgo(ctx, term, num : int = 0): url = (s['RelatedTopics'][num]['FirstURL']) icon = (s['RelatedTopics'][num]['Icon']['URL']) text = (s['RelatedTopics'][num]['Text']) - + embed=discord.Embed(title="Search", url=url) embed.set_author(name="Duckduckgo", icon_url="https://upload.wikimedia.org/wikipedia/en/9/90/The_DuckDuckGo_Duck.png") embed.set_thumbnail(url=icon) embed.add_field(name=term, value=text, inline=True) embed.set_footer(icon_url=f"{ctx.author.avatar_url}", text=f"Requested by {ctx.author.name}#{ctx.author.discriminator}") - + await ctx.send(embed=embed) except: await ctx.send("An error occured (Empty JSON)") - + def neko(reaction): if reaction == "kiss": - lines = open("nekos/kiss.txt").read().splitlines() + lines = open("dbs/nekos/kiss.txt").read().splitlines() joke = random.choice(lines) elif reaction == "hug": - lines = open("nekos/hug.txt").read().splitlines() + lines = open("dbs/nekos/hug.txt").read().splitlines() joke = random.choice(lines) elif reaction == "poke": - lines = open("nekos/poke.txt").read().splitlines() + lines = open("dbs/nekos/poke.txt").read().splitlines() joke = random.choice(lines) return joke - + @bot.command() async def kiss(ctx, person : discord.User=None): a = neko("kiss") await ctx.send(f"{ctx.author.mention} Kissed {person.mention}\n{a}") - + @bot.command() async def hug(ctx, person : discord.User=None): a = neko("hug") await ctx.send(f"{ctx.author.mention} Hugged {person.mention}\n{a}") - + @bot.command() async def poke(ctx, person : discord.User=None): a = neko("poke") await ctx.send(f"{ctx.author.mention} Poked {person.mention}\n{a}") - + @bot.command() async def gelbooru(ctx, tags, num : int = 0): - url = f"https://gelbooru.com/index.php?page=dapi&s=post&q=index&tags={tag}&json=1" - - headers = {'User-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:80.0) Gecko/20100101 Firefox/80.0'} - - r = requests.get(url, headers=headers) + url = f"https://gelbooru.com/index.php?page=dapi&s=post&q=index&tags={tags}&json=1" + + r = requests.get(url) s = r.json() - - imgid = (s[0]['id']) - rating = (s[0]['rating']) - hashimg = (s[0]['hash']) - - source = (s[0]['source']) - tags = (s[0]['tags']) - image = (s[0]['file_url']) + + imgid = (s[num]['id']) + hashimg = (s[num]['hash']) + source = (s[num]['source']) + image = (s[num]['file_url']) + posturl = f"https://gelbooru.com/index.php?page=post&s=view&id={imgid}" embed1=discord.Embed(title="Gelbooru Search", color=0xc290c6) - embed1.add_field(name="ID:", value=imgid, inline=False) - embed1.add_field(name="Rating:", value=rating, inline=False) - embed1.add_field(name="Source:", value=source, inline=False) - embed1.add_field(name="Tags:", value=tags, inline=False) - embed1.set_footer(text=f"Hash: {hashimg} ") + embed1.add_field(name="ID:", value=imgid, inline=True) + embed1.add_field(name="Requested tag(s):", value=tags, inline=False) embed1.set_image(url=image) - await ctx.send(embed=embed1) + embed1.set_footer(text=f"Hash: {hashimg} \nSource: {source} \nPost URL: {posturl} \nImage URl: {image}") + if ctx.channel.is_nsfw(): + await ctx.send(embed=embed1) + else: + if "rating:safe" in tags: + await ctx.send(embed=embed1) + elif "rating:safe" not in tags: + await ctx.send("nsfw command") + +@bot.command() +async def gelbooru2(ctx, tags, num : int = 0): + url = f"https://gelbooru.com/index.php?page=dapi&s=post&q=index&tags={tags}&json=1" + + r = requests.get(url) + s = r.json() + + imgid = (s[num]['id']) + hashimg = (s[num]['hash']) + source = (s[num]['source']) + image = (s[num]['file_url']) + posturl = f"https://gelbooru.com/index.php?page=post&s=view&id={imgid}" + embed1=discord.Embed(title="Gelbooru Search", color=0xc290c6) + embed1.add_field(name="ID:", value=imgid, inline=True) + embed1.add_field(name="Requested tag(s):", value=tags, inline=False) + embed1.set_image(url=image) + embed1.set_footer(text=f"Hash: {hashimg} \nSource: {source} \nPost URL: {posturl} \nImage URl: {image}") + await ctx.send(embed=embed1) @bot.command() async def urlcheck(ctx, url): try: line_count = 0 - + o = urlparse(url) domain = o.netloc if domain == "": await ctx.send("Invalid link") return - + await ctx.send(f"Checking `{url}`") - with open("/home/sosoplayz/vps-backup/useful/iplog/iploggers.txt") as f: + with open("dbs/iploggers.txt") as f: for line in f: line_count += 1 if domain in line: @@ -1239,17 +1257,22 @@ async def urlcheck(ctx, url): await ctx.send(f"`{url}` Is safe :white_check_mark:, Scanned out of {line_count} URLs\n{domain}") except Exception as x: await ctx.send(f"Error: ```{x}```") - - + +@bot.command() +async def gay(ctx, url : str = None): + if url == None: + url = ctx.message.attachments[0].url + await ctx.send(f"https://some-random-api.ml/canvas/gay?avatar={url}") + @bot.command() async def lyrics(ctx, *, song): - + ss = song.replace(" ", "%20") url = f"https://some-random-api.ml/lyrics?title={ss}" - + r = requests.get(url) s = r.json() - + title = (s['title']) author = (s['author']) lyrics = (s['lyrics']) @@ -1257,45 +1280,22 @@ async def lyrics(ctx, *, song): link = (s['links']['genius']) formatted_lyrics = lyrics.replace('\\n', '\n').replace('\\t', '\t')[:1024] - + embed1=discord.Embed(title="Lyrics Search", color=0xc290c6) embed1.set_thumbnail(url=thumbnail) embed1.add_field(name="Title:", value=title, inline=True) embed1.add_field(name="Author:", value=author, inline=False) embed1.add_field(name="Lyrics:", value=formatted_lyrics, inline=False) embed1.set_footer(text=f"Link: {link}") - + await ctx.send(embed=embed1) - + if len(lyrics) > 1024: - await ctx.send(f"```{formatted_lyrics}```") - - -@bot.command() -async def aita(ctx): - - rs = requests.get(f"https://www.random.org/integers/?num=1&min=0&max=25&col=1&base=10&format=plain&rnd=new") - qs = (rs.text) - q = int(qs) - - - url = "https://www.reddit.com/r/amitheasshole.json" - headers = {'User-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:80.0) Gecko/20100101 Firefox/80.0'} - - r = requests.get(url, headers=headers) - s = r.json() - - title = (s['data']['children'][q]['data']['title']) - content = (s['data']['children'][q]['data']['selftext']) - - formatted_content = content.replace('\\n', '\n').replace('\\t', '\t') - - msg = (f"{title}\n\n{formatted_content}")[:2000] - - await ctx.send(msg) - + await ctx.send("Warning, lyrics were cut to fit into the message, see link for the full lyrics.") + @bot.command() async def tag(ctx, mode, *, insertion : str = None): + # some variables authorid = ctx.author.id currenttime = f"{datetime.date(datetime.now())} At {datetime.time(datetime.now())} GMT +3" @@ -1311,40 +1311,60 @@ async def tag(ctx, mode, *, insertion : str = None): pass if mode == "add": - if "@everyone" in insertion or "@here" in insertion: - await ctx.send("no") - else: - if secondword == "" or secondword == None: - await ctx.send("content can't be empty") + try: + if "@everyone" in insertion or "@here" in insertion: + await ctx.send("no") else: - sql = 'INSERT INTO TAG (id, name, content, date) values(?, ?, ?, ?)' - data = [ - (authorid, firstword, formatinsertion, currenttime), - ] - with connection: - connection.executemany(sql, data) - await ctx.send(f"Tag `{firstword}` Successfully added.") + if secondword == "" or secondword == None: + await ctx.send("content can't be empty") + else: + sql = 'INSERT INTO TAG (id, name, content, date) values(?, ?, ?, ?)' + data = [ + (authorid, firstword, formatinsertion, currenttime), + ] + with connection: + connection.executemany(sql, data) + await ctx.send(f"Tag `{firstword}` Successfully added.") + except Exception as x: + await ctx.send(f"```{x}```") elif mode == "delete": with connection: - data = connection.execute(f"SELECT * FROM TAG WHERE name LIKE '{mode}'") + data = connection.execute(f"SELECT * FROM TAG WHERE name LIKE '{firstword}'") for row in data: a = (row[0]) - if ctx.author.id == a: - data = connection.execute(f"DELETE FROM TAG WHERE name LIKE '{firstword}'") - await ctx.send(f"Successfully deleted tag `{firstword}`") - else: - await ctx.send(f"{ctx.author.mention} You do not have permission to delete the `{firstword}` tag.") + if ctx.author.id == a: + connection.execute(f"DELETE FROM TAG WHERE name LIKE '{firstword}'") + await ctx.send(f"Successfully deleted tag `{firstword}`") + else: + await ctx.send(f"{ctx.author.mention} You do not have permission to delete the `{firstword}` tag.") + + elif mode == "owner": + with connection: + data = connection.execute(f"SELECT * FROM TAG WHERE name LIKE '{firstword}'") + for row in data: + a = (row[0]) + avamember = await bot.fetch_user(a) + await ctx.send(f"`{firstword}` is owned by `{avamember.name}#{avamember.discriminator}`") + elif mode == "list": taglist = "" data = connection.execute(f"SELECT * FROM TAG WHERE id LIKE '{authorid}'") - for row in data: + for row in data: name = (row[1]) date = (row[3]) taglist += (f"`{name}` Created on `{date}`\n") await ctx.send(f"List of tags owned by `{ctx.author.name}#{ctx.author.discriminator}`:\n{taglist}") + + elif mode == "random": + with connection: + data = connection.execute("SELECT * FROM TAG ORDER BY RANDOM() LIMIT 1;") + for row in data: + tagname = (row[1]) + data = (row[2]) + await ctx.send(f"**Tag: {tagname}**\n{data}") else: with connection: @@ -1352,14 +1372,14 @@ async def tag(ctx, mode, *, insertion : str = None): for row in data: a = (row[2]) await ctx.send(a) - + @bot.command() async def invite(ctx): await ctx.send(f"{ctx.author.mention} https://discord.com/api/oauth2/authorize?client_id=754720671518687322&permissions=125952&scope=bot") @bot.command() async def politeness(ctx, *, inputt): - + formatted_input = inputt.replace(" ", "+") headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:81.0) Gecko/20100101 Firefox'} data = {'text': formatted_input} @@ -1369,12 +1389,12 @@ async def politeness(ctx, *, inputt): confidence = (s['confidence']) label = (s['label']) - + await ctx.send(f"Label: {label}\nConfidence: {confidence}") - + @bot.command() async def fraudcheck(ctx, *, ip): - url = (f"https://ipqualityscore.com/api/json/ip/APIKEYHERE/{ip}?strictness=0&allow_public_access_points=true&fast=true&lighter_penalties=true&mobile=true") + url = (f"https://ipqualityscore.com/api/json/ip/???????????????????/{ip}?strictness=0&allow_public_access_points=true&fast=true&lighter_penalties=true&mobile=true") headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:81.0) Gecko/20100101 Firefox'} r = requests.post(url, headers=headers) s = r.json() @@ -1391,27 +1411,26 @@ async def fraudcheck(ctx, *, ip): recent_abuse = (s['recent_abuse']) bot_status = (s['bot_status']) request_id = (s['request_id']) - + msg = f"```Fraud score: {fraud_score}\nCountry Code: {country_code}\nCity: {city}\nISP: {ISP}\nASN: {ASN}\nHost: {host}\nProxy: {proxy}\nVPN: {vpn}\nTOR: {tor}\nRecent Abuse: {recent_abuse}\nBot Status: {bot_status}\nRequest ID: {request_id}```" - await ctx.send(msg) def saucesearch(url): - url = (f"https://saucenao.com/search.php?api_key=25fe684c5e5981db9fcdab3fdd9b019e5afcb839&db=999&output_type=2&testmode=1&numres=16&url={url}") + url = (f"https://saucenao.com/search.php?api_key=??????????????????????&db=999&output_type=2&testmode=1&numres=16&url={url}") headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:81.0) Gecko/20100101 Firefox'} r = requests.post(url, headers=headers) s = r.json() limit = (s['header']['long_remaining']) - + simres0 = (s['result'][0]['header']['similarity']) indexnameres0 = (s['result'][0]['header']['index_name']) urlres0 = (s['result'][0]['data']['ext_urls'[0]]) - + simres1 = (s['result'][1]['header']['similarity']) indexnameres1 = (s['result'][1]['header']['index_name']) urlres1 = (s['result'][1]['data']['ext_urls'[0]]) - + simres2 = (s['result'][2]['header']['similarity']) indexnameres2 = (s['result'][2]['header']['index_name']) urlres2 = (s['result'][2]['data']['ext_urls'[0]]) @@ -1422,72 +1441,79 @@ def saucesearch(url): async def sauce(ctx, link : str = None): if not ctx.message.attachments: await ctx.channel.send("Searching...") - + else: await ctx.channel.send("Searching...") link = (""'{}'"").format(ctx.message.attachments[0].url) - - url = (f"https://saucenao.com/search.php?api_key=25fe684c5e5981db9fcdab3fdd9b019e5afcb839&db=999&output_type=2&testmode=1&numres=16&url={link}") + + url = (f"https://saucenao.com/search.php?api_key=??????????????????????&db=999&output_type=2&testmode=1&numres=16&url={link}") headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:81.0) Gecko/20100101 Firefox'} r = requests.post(url, headers=headers) s = r.json() limit = (s['header']['long_remaining']) - + simres0 = (s['results'][0]['header']['similarity']) indexnameres0 = (s['results'][0]['header']['index_name']) urlres0 = (s['results'][0]['data']['ext_urls'][0]) - + simres1 = (s['results'][1]['header']['similarity']) indexnameres1 = (s['results'][1]['header']['index_name']) urlres1 = (s['results'][1]['data']['ext_urls'][0]) - + simres2 = (s['results'][2]['header']['similarity']) indexnameres2 = (s['results'][2]['header']['index_name']) urlres2 = (s['results'][2]['data']['ext_urls'][0]) await ctx.send(f"Sauce found:\nSearches remaining for today: {limit}\n```Result 1:\nSimilarity: {simres0}\nIndex Name: {indexnameres0}\nURL: {urlres0}\n\nResult 2:\nSimilarity: {simres1}\nIndex Name: {indexnameres1}\nURL: {urlres1}\n\nResult 3:\nSimilarity: {simres2}\nIndex Name: {indexnameres2}\nURL: {urlres2}```") + @bot.command() -async def sqlsearch(ctx, *, term): # Used for the memecord message Database - match_count = 0 - with connection2: - data = connection2.execute(f"SELECT * FROM LOGS WHERE content LIKE '{term}' COLLATE NOCASE") - for row in data: - match_count += 1 - dbid = (row[0]) - msgid = (row[1]) - authorname = (row[2]) - avatar = (row[3]) - chid = (row[4]) - userid = (row[5]) - content = (row[6]) - channelname = (row[7]) - timer = (row[8]) - - msg = f"(temporary formatting)\nDB-ID: {dbid}\nMessage ID: {msgid}\nAuthor: {authorname}\nAvatar: `{avatar}`\nChannel ID: {chid}\nUser ID: {userid}\nContent: `{content}`\nTimestamp: {timer}\nMatch number: {match_count}" - - formattedname = f"{authorname} [ID: {userid}]" - - embed=discord.Embed(title=f"Search result for \n`{term}`", description=f"Match #{match_count} | Message ID: {msgid}", color=0x800040) - embed.set_author(name=formattedname, icon_url=avatar) - embed.add_field(name="Content:", value=content, inline=False) - embed.set_footer(text=f"Touhoubot V2 \nChannel ID: {chid} \nTimestamp: {timer} (GMT +3)\nDatabase ID: {dbid}") - await ctx.send(embed=embed) - if match_count > 1: - await ctx.send("Over 2 results found. Quitting!") - return - if match_count == 0: - await ctx.send("No results found.") - return - await ctx.send("Execution successful.") - - +async def textread(ctx): + attachmentfilename = (""'{0}'"").format(ctx.message.attachments[0].filename) + if "txt" in attachmentfilename: + attachmenturl = (""'{}'"").format(ctx.message.attachments[0].url) + attachmentname = ('readable.txt') + headers = { + 'User-agent': 'Mozilla/5.0 (Windows NT 6.3; rv:36.0) Gecko/20100101 Firefox/36.0' + } + r = requests.get(attachmenturl, headers=headers, stream=True) + with open(attachmentname, 'wb') as out_file: + shutil.copyfileobj(r.raw, out_file) + del r + + f = open('readable.txt', 'r') + line = f.read() + print(line) + + if len(line) > 8000: + await ctx.send("Too long") + else: + n = 2 + + q = [line[i:i+n] for i in range(0, len(line), n)] + print(q) + for p in q: + print(p) + await ctx.send(f"```{p}```") + +@bot.command() +async def yuri(ctx): + lines = open("yurilist.txt").read().splitlines() + yuri = secrets.choice(lines) + await ctx.send(f"{yuri}") + @bot.command() async def ruined(ctx, avamember : discord.User=None): await ctx.send(f"{avamember.mention} https://cdn.discordapp.com/attachments/769023126507356163/769630011770142740/fedora_2020_10_22__11_50_53.png") - - + +@bot.command() +async def anchovy(ctx): + lines = open("anchovy.txt").read().splitlines() + anchovy = secrets.choice(lines) + await ctx.send(f"{anchovy}") + + @bot.command() async def charactersearch(ctx, *, char): url = f"https://api.jikan.moe/v3/search/character?q={char}&page=1" @@ -1501,10 +1527,11 @@ async def charactersearch(ctx, *, char): await ctx.send(f"Search result\n{image}\n`{name}`") + @bot.command() async def animesearch(ctx, *, anime): - url = f"https://api.jikan.moe/v3/search/character?q={anime}&page=1" + url = f"https://api.jikan.moe/v3/search/anime?q={anime}&page=1" headers = {'User-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:80.0) Gecko/20100101 Firefox/80.0'} r = requests.get(url, headers=headers) @@ -1519,8 +1546,8 @@ async def animesearch(ctx, *, anime): start_date = (s['results'][0]['start_date']) end_date = (s['results'][0]['end_date']) - await ctx.send(f"Search result\n\n**Title:** {title}\n\n**Synopsis:** {synopsis}\n\n**Episodes:** {episodes}\n**Score:** {score}\n**Start date:** {start_date}\n**End date:** {end_date}\n\n{image}\n{name}`") - + await ctx.send(f"Search result\n\n**Title:** {title}\n\n**Synopsis:** {synopsis}\n\n**Episodes:** {episodes}\n**Score:** {score}\n**Start date:** {start_date}\n**End date:** {end_date}\n\n{image}`") + @bot.command() async def define(ctx, *, term): @@ -1536,14 +1563,14 @@ async def define(ctx, *, term): definition = (s[0]['meanings'][0]['definitions'][0]['definition']) msg = f"**Word:** `{name} {pronouncation}`\n\n**Definition:** ```{definition}```" - + await ctx.send(msg) - - + + @bot.command() async def character(ctx, char): def charlink(character): - lines = open(f"resources/links-db/{char}.txt").read().splitlines() + lines = open(f"dbs/links-db/{char}.txt").read().splitlines() img = secrets.choice(lines) return img @@ -1569,6 +1596,10 @@ async def character(ctx, char): await ctx.send(charlink("satania")) elif char.lower() == "mankanshoku": await ctx.send(charlink("mankanshoku")) + elif char.lower() == "maid": + await ctx.send(charlink("maid")) + elif char.lower() == "pocky": + await ctx.send(charlink("pocky")) elif char.lower() in "saren": await ctx.send("An error occured, Please try again.") @@ -1579,12 +1610,443 @@ async def character(ctx, char): await ctx.send("```List of available characters\n\nmako\nanchovy\nyuri\naqua\nmio\nmiho\nhana\nsaori\nerina\nsaren\npecorine\nsatania\nmankanshoku```") else: await ctx.send("```unknown character\n\nsee %character list for a list of characters```") + + +@bot.command() +async def ping(ctx): + await ctx.send(f'Pong! In {round(bot.latency * 1000)}ms') + +@bot.command() +async def aita(ctx): + + rs = requests.get(f"https://www.random.org/integers/?num=1&min=0&max=25&col=1&base=10&format=plain&rnd=new") + qs = (rs.text) + q = int(qs) + + + url = "https://www.reddit.com/r/amitheasshole.json" + headers = {'User-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:80.0) Gecko/20100101 Firefox/80.0'} + + r = requests.get(url, headers=headers) + s = r.json() + + title = (s['data']['children'][q]['data']['title']) + content = (s['data']['children'][q]['data']['selftext']) + + formatted_content = content.replace('\\n', '\n').replace('\\t', '\t') + + msg = (f"{title}\n\n{formatted_content}")[:2000] + + await ctx.send(msg) + + +@bot.command() +async def maid(ctx): + url = f"https://gelbooru.com/index.php?page=dapi&s=post&q=index&tags=maid+rating:safe&json=1" + + r = requests.get(url) + s = r.json() + num = random.randrange(100) + image = (s[num]['file_url']) + await ctx.send(image) + @bot.command() -async def ping(ctx): - await ctx.send(f'My ping is {bot.latency}!') +async def emailgen(ctx): + url = "https://www.1secmail.com/api/v1/?action=genRandomMailbox&count=1" + headers = {'User-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:80.0) Gecko/20100101 Firefox/80.0'} + + r = requests.get(url, headers=headers) + s = r.json() + + address = (s[0]) + + await ctx.send(f"{ctx.author.mention} You have been assigned the address `{address}`. To view your inbox, Use %emailbox ADDRESS (Make sure not to include @1secmail.org)") + +@bot.command() +async def emailbox(ctx, address): + + inbox = "" + + url = f"https://www.1secmail.com/api/v1/?action=getMessages&login={address}&domain=1secmail.com" + headers = {'User-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:80.0) Gecko/20100101 Firefox/80.0'} + + r = requests.get(url, headers=headers) + s = r.json() + + for i in range(25): + try: + id = (s[i]['id']) + sender = (s[i]['from']) + subject = (s[i]['subject']) + date = (s[i]['date']) + + inbox += f"\nID: {id}\nFrom: {sender}\nSubject: {subject}\nDate: {date}" + except Exception as x: + await ctx.send(x) + return + + await ctx.send(f"```{inbox}```") + + + +@bot.command() +async def gelboorubomb(ctx, tags, times : int = 0): + url = f"https://gelbooru.com/index.php?page=dapi&s=post&q=index&tags={tags}&json=1" + + r = requests.get(url) + s = r.json() + for num in range(times): + imgid = (s[num]['id']) + hashimg = (s[num]['hash']) + source = (s[num]['source']) + image = (s[num]['file_url']) + posturl = f"https://gelbooru.com/index.php?page=post&s=view&id={imgid}" + + embed1=discord.Embed(title="Gelbooru Search", color=0xc290c6) + embed1.add_field(name="ID:", value=imgid, inline=True) + embed1.add_field(name="Requested tag(s):", value=tags, inline=False) + embed1.add_field(name="Image number:", value=f"{num} out of {times - 1}", inline=False) + embed1.set_image(url=image) + embed1.set_footer(text=f"Hash: {hashimg} \nSource: {source} \nPost URL: {posturl} \nImage URl: {image}") + if ctx.channel.is_nsfw(): + await ctx.send(embed=embed1) + else: + if "rating:safe" in tags or ctx.channel.id == "850399382503424043": + await ctx.send(embed=embed1) + elif "rating:safe" not in tags: + await ctx.send("nsfw command") + +@bot.command() +async def gelboorubomb2(ctx, tags, times : int = 0): + url = f"https://gelbooru.com/index.php?page=dapi&s=post&q=index&tags={tags}&json=1" + + r = requests.get(url) + s = r.json() + for num in range(times): + imgid = (s[num]['id']) + hashimg = (s[num]['hash']) + source = (s[num]['source']) + image = (s[num]['file_url']) + posturl = f"https://gelbooru.com/index.php?page=post&s=view&id={imgid}" + + embed1=discord.Embed(title="Gelbooru Search", color=0xc290c6) + embed1.add_field(name="ID:", value=imgid, inline=True) + embed1.add_field(name="Requested tag(s):", value=tags, inline=False) + embed1.add_field(name="Image number:", value=f"{num} out of {times - 1}", inline=False) + embed1.set_image(url=image) + embed1.set_footer(text=f"Hash: {hashimg} \nSource: {source} \nPost URL: {posturl} \nImage URl: {image}") + +@bot.command() +async def genderguesser(ctx, name): + if name.lower() == "calv" or name.lower() == "calvanyan": + await ctx.send(f"The name `{name}` is female\nSamples: 17515\nAccuracy: 98") + return + + url = f"https://gender-api.com/get?name={name}&key=JKhHvRaGzSDJfGRLcq" + headers = {'User-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:80.0) Gecko/20100101 Firefox/80.0'} + + r = requests.get(url, headers=headers) + s = r.json() + + gender = (s['gender']) + samples = (s['samples']) + accuracy = (s['accuracy']) + + await ctx.send(f"The name `{name}` is {gender}\nSamples: {samples}\nAccuracy: {accuracy}") +@bot.command() +async def ffmpeg(ctx, *, ext): + urlll = (""'{}'"").format(ctx.message.attachments[0].url) + urlllname = (""'{}'"").format(ctx.message.attachments[0].filename) + print(urlll) + print(urlllname) + headers = { + 'User-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:80.0) Gecko/20100101 Firefox/80.0' + } + r = requests.get(urlll, headers=headers, stream=True) + + with open(urlllname, 'wb') as out_file: + shutil.copyfileobj(r.raw, out_file) + del r + await ctx.send(f"Rendering `{urlllname}` as `{ext}`") + # ffmpeg command + os.system(f"ffmpeg -i {urlllname} -fs 7000000 output{ctx.message.id}.{ext}") + fileout = f"output{ctx.message.id}.{ext}" + await ctx.channel.send(f"Rending `output{ctx.message.id}.{ext}` completed", file=discord.File(fileout)) + os.system(f"rm output{ctx.message.id}.{ext}") + os.remove(urlllname) + +@bot.command() +async def ffmpeg2(ctx, ext, *, args): + + urlll = (""'{}'"").format(ctx.message.attachments[0].url) + urlllname = (""'{}'"").format(ctx.message.attachments[0].filename) + print(urlll) + print(urlllname) + headers = { + 'User-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:80.0) Gecko/20100101 Firefox/80.0' + } + r = requests.get(urlll, headers=headers, stream=True) + + with open(urlllname, 'wb') as out_file: + shutil.copyfileobj(r.raw, out_file) + del r + await ctx.send(f"Rendering `{urlllname}` as `{ext}`") + # ffmpeg command + os.system(f"ffmpeg -i {urlllname} -fs 7000000 {args} output.{ext}") + fileout = f"output.{ext}" + await ctx.channel.send(f"Rending `output{ctx.message.id}.{ext}` completed", file=discord.File(fileout)) + os.remove(urlllname) + os.remove(fileout) + +@bot.command() +async def screenshot(ctx, url): + url2 = f"https://api.apiflash.com/v1/urltoimage?access_key=84f448c81a3f4ddbacf188aca585a4f6&url={url}" + r = requests.get(url2) + print(r.headers) + if "text/html" in r.headers: + await ctx.send(f"An error occured while connecting to `{url}`") + else: + await ctx.send(url2) + +@bot.command() +async def twerkradio(ctx, loop : int = 1): + if ctx.author.voice and ctx.author.voice.channel: + channel = ctx.author.voice.channel + vc = await channel.connect() + try: + if loop > 500: + await ctx.send(f"{ctx.author.mention} a limit of 500 was added because 7gb of bandwidth was used by this command in a day") + await ctx.voice_client.disconnect() + return + else: + + for i in range(loop): + vc.play(discord.FFmpegPCMAudio("twerkradio.mp3")) + await ctx.send("twerk radio yeah you're hella gay yeah you watch gay porn cause you're hella gay you get horny from black ass twerking") + while vc.is_playing(): + await asyncio.sleep(1) + await ctx.voice_client.disconnect() + except Exception as x: + print(x) + exc = (":boom: **Error**```{0}```").format(x) + await ctx.channel.send(exc) + else: + await ctx.send("You are not connected to a voice channel") + return + +@bot.command() +async def sfx(ctx, sound, times : int = 1): + if ctx.author.voice and ctx.author.voice.channel: + channel = ctx.author.voice.channel + vc = await channel.connect() + try: + for i in range(times): + vc.play("resources/sfx/" + discord.FFmpegPCMAudio(sound.lower() + ".mp3")) + while vc.is_playing(): + await asyncio.sleep(1) + await ctx.voice_client.disconnect() + except Exception as x: + print(x) + exc = (":boom: **Error**```{0}```").format(x) + await ctx.channel.send(exc) + else: + await ctx.send("You are not connected to a voice channel") + return + +@bot.command() +async def allsfx(ctx): + if ctx.author.voice and ctx.author.voice.channel: + channel = ctx.author.voice.channel + vc = await channel.connect() + try: + vc.play(discord.FFmpegPCMAudio("reallyniga.mp3")) + while vc.is_playing(): + await asyncio.sleep(1) + vc.play(discord.FFmpegPCMAudio("thud.mp3")) + while vc.is_playing(): + await asyncio.sleep(1) + vc.play(discord.FFmpegPCMAudio("ohhellnaw.mp3")) + while vc.is_playing(): + await asyncio.sleep(1) + vc.play(discord.FFmpegPCMAudio("lolimoan3.mp3")) + while vc.is_playing(): + await asyncio.sleep(1) + vc.play(discord.FFmpegPCMAudio("battery.mp3")) + while vc.is_playing(): + await asyncio.sleep(1) + vc.play(discord.FFmpegPCMAudio("bruh.mp3")) + while vc.is_playing(): + await asyncio.sleep(1) + vc.play(discord.FFmpegPCMAudio("twerkradio.mp3")) + while vc.is_playing(): + await asyncio.sleep(1) + vc.play(discord.FFmpegPCMAudio("lebronjames.mp3")) + while vc.is_playing(): + await asyncio.sleep(1) + + await ctx.voice_client.disconnect() + except Exception as x: + print(x) + exc = (":boom: **Error**```{0}```").format(x) + await ctx.channel.send(exc) + else: + await ctx.send("You are not connected to a voice channel") + return + +@bot.command() +async def ship2(ctx, person1, person2): + headers = {'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64; rv:89.0) Gecko/20100101 Firefox/89.0'} + response = requests.post(f'https://lovecalculator.love/results/{person1}-and-{person2}', headers=headers) + fart = response.content + h = html2text.HTML2Text() + h.ignore_links = True + aaa = h.handle(f"{fart}") + s = aaa.replace("\\r", "") + q = s.replace("\\n", "") + t = "" + text = "\n".join([ll.rstrip() for ll in q.splitlines() if ll.strip()]) + aa = text.replace("by LoveCalculator.love", "") + bb = aa.replace(" > go back home" , "") + cc = bb.replace("Love Calculator | FAQ | About", "") + dd = cc.replace("xoxo // the loove.love collection", "") + ee = dd.replace("# Love Calculator", "") + ff = ee.replace("b'", "") + gg = ff.replace("'", "") + text2 = "\n".join([ll.rstrip() for ll in gg.splitlines() if ll.strip()]) + await ctx.send(f"{ctx.author.mention}\n{text2}") + +def tmpupload(): + location = '/home/soso/bot/ytdl/ytdl-tmpvid.mp4' + params = (('output', 'text'),) + files = {'files[]': (location, open(location, 'rb')),} + response = requests.post('https://tmp.ninja/upload.php', params=params, files=files) + return response.text + +@bot.command() +async def youtubedl(ctx, video): + os.system('rm /home/soso/bot/ytdl/ytdl-tmpvid.mkv && rm /home/soso/bot/ytdl/ytdl-tmpvid.mp4') + try: + await ctx.send("Downloading video... ") + os.system(f'youtube-dl --merge-output-format mkv --output "/home/soso/bot/ytdl/ytdl-tmpvid.%(ext)s" {video}') + await ctx.send("Converting video... ") + os.system('ffmpeg -i /home/soso/bot/ytdl/ytdl-tmpvid.mkv -crf 29 /home/soso/bot/ytdl/ytdl-tmpvid.mp4') + await ctx.send("Removing MKV... ") + os.system('rm /home/soso/bot/ytdl/ytdl-tmpvid.mkv') + await ctx.send("Attempting to upload... ") + url = tmpupload() + await ctx.send(f"{ctx.author.mention} Your video was successfully uploaded (Link expires in 48 hours).\n{url}") + os.system('rm /home/soso/bot/ytdl/ytdl-tmpvid.mp4') + except Exception as x: + await ctx.send(f"An error has occured.\nLog:\n```{x}```") + os.system('rm /home/soso/bot/ytdl/ytdl-tmpvid.mkv') + +@bot.command() +async def archive(ctx, msgid : int = None): + try: + if msgid == None: + await ctx.send("You must provide a message ID!", delete_after(5)) + return + else: + msg = await ctx.fetch_message(msgid) + content = str(msg.content) + author = str(msg.author) + content = str(msg.content) + clean_content = msg.clean_content + jump_url = msg.jump_url + date = msg.created_at + date_edited = msg.edited_at + hash_msg = hash(msg) + uuid = msg.author.id + attachments = msg.attachments + if not msg.attachments: + attachment_url = "None" + else: + attachment_url = msg.attachments[0].url + await ctx.send("Contacting Database ", delete_after=3) + sql = 'INSERT INTO ARCHIVE (id, author, content, clean_content, jump_url, attachment_url, date, date_edited, hash, uuid) values(?, ?, ?, ?, ?, ?, ?, ?, ?, ?)' + data = [(msgid, author, content, clean_content, jump_url, attachment_url, date, date_edited, hash_msg, uuid)] + with connection2: + connection2.executemany(sql, data) + await ctx.send(f"Message {msgid} by `{author}` Successfully archived.") + except Exception as x: + await ctx.send(x) + +@bot.command() +async def archivelookup(ctx, msgid): + try: + if msgid == "none": + await ctx.send("You must provide a message ID!", delete_after(5)) + return + else: + data = connection2.execute(f"SELECT * FROM ARCHIVE WHERE id LIKE '{msgid}'") + for row in data: + # parse data from sqlite database + author = (row[1]) + content = (row[2]) + clean_content = (row[3]) + jump_url = (row[4]) + attachment_url = (row[5]) + date = (row[6]) + date_edited = (row[7]) + hash_msg = (row[8]) + uuid = (row[9]) + + # get the user and bot's avatar + usr = await bot.fetch_user(uuid) + avatar = usr.avatar_url + botava = await bot.fetch_user(754720671518687322) + avatarbot = botava.avatar_url + + # disord embed + embed=discord.Embed(title="Message Lookup", color=0x22ff00) + embed.set_author(name="Funny cat Archive", icon_url=(avatarbot)) + embed.set_thumbnail(url=avatar) + embed.add_field(name="Message ID:", value=msgid, inline=True) + embed.add_field(name="Author:", value=author, inline=True) + embed.add_field(name="Author ID:", value=uuid, inline=True) + embed.add_field(name="Content:", value=f"```{clean_content}```", inline=False) + embed.add_field(name="Jump URL", value=jump_url, inline=True) + embed.add_field(name="Attachment", value=attachment_url, inline=True) + embed.add_field(name="Date", value=date, inline=True) + embed.add_field(name="Date Edited", value=date_edited, inline=True) + embed.add_field(name="Hash", value=hash_msg, inline=True) + await ctx.send(embed=embed) + except Exception as x: + await ctx.send(x) + +""" + if number == None: + z = int(idd) + channel = bot.get_channel(z) + vc = await channel.connect() + try: + vc.play(discord.FFmpegPCMAudio(effect + ".mp3")) + while vc.is_playing(): + await asyncio.sleep(1) + await ctx.voice_client.disconnect() + except Exception as x: + print(x) + exc = (":boom: **Error**```{0}```").format(x) + await ctx.channel.send(exc) + else: + z = int(idd) + channel = bot.get_channel(z) + vc = await channel.connect() + x = int(number) + try: + for i in range(x): + vc.play(discord.FFmpegPCMAudio(effect + ".mp3")) + while vc.is_playing(): + await asyncio.sleep(1) + await ctx.voice_client.disconnect() + except Exception as x: + print(x) + exc = (":boom: **Error**```{0}```").format(x) + await ctx.channel.send(exc) +""" bot.run(TOKEN)