Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
54 kB
0
Indexable
Never
# bot.py
import asyncio
import itertools
import json
import os
import random
import re
import sqlite3
import sys
import time
import traceback
from disputils import BotEmbedPaginator, BotConfirmation, BotMultipleChoice

import asyncpg
import discord
from discord.ext import commands, tasks
from discord import Embed
import mysql.connector
import MySQLdb
from mysql.connector import MySQLConnection, Error
from python_mysql_dbconfig import read_db_config


###########################discord  declarations###########################
token = "Njc0NDMzNzY2NjM0MDI5MDc2.Xjw2pw.FY6eqjMKQOpk9jy1QkOJUHNfwh4"
game = discord.Game("with an infinite universe.")
intents = discord.Intents.default()
intents.members = True
intents.presences = True
bot = commands.Bot(command_prefix='!', activity=game, case_insensitive=True, intents=intents)

class DBConnection(object):

    def __init__(self, DB_HOST, DB_PORT, DB_USER, DB_PASSWORD, DB_NAME):
        self.host = DB_HOST
        self.port = DB_PORT
        self.name = DB_NAME
        self.user = DB_USER
        self.password = DB_PASSWORD
        self.con = None

    def connect_db(self):
        if self.con is None:
            self.con = MySQLdb.connect(host = self.host, port = self.port, db = self.name, user = self.user, passwd = self.password)
            self.con.set_character_set("utf8")
        return self.con

    def fetch_db(self, query):
        self.query = query
        self.cursor = self.con.cursor()
        self.cursor.execute("SET NAMES utf8;")
        self.cursor.execute("SET CHARACTER SET utf8;")
        self.cursor.execute("SET character_set_connection=utf8;")
        self.cursor.execute(self.query)
        self.result = self.cursor.fetchone()

        return self.result

    def insert_db(self, query):
        self.query = query
        self.cursor = self.con.cursor()
        self.cursor.execute("SET NAMES utf8;")
        self.cursor.execute("SET CHARACTER SET utf8;")
        self.cursor.execute("SET character_set_connection=utf8;")
        self.cursor.execute(self.query)
        self.con.commit()

        return

DBC = DBConnection('synsol.josdim10.dreamhosters.com',3306,'jrdimpfl','Midnight1','synsol')
con = DBC.connect_db()
cursor = con.cursor()
print('getting code....')


async def run():
    prev_id = 0
    clr = 'None'
    clr2 = 'None'
    while True:
     
        cursor.execute("SELECT r_id FROM reports LEFT JOIN `photos` ON p_report=r_id LEFT JOIN `users` ON u_id=r_owner LEFT JOIN `genus` ON g_common=r_genus WHERE now() GROUP BY r_id ORDER BY r_created DESC LIMIT 1;")
        myresult = cursor.fetchone()
        time.sleep(10)
        for data in myresult:
            u_id = data
            
            if u_id > prev_id:
                print(f"U_ID = {u_id}")
                print(f"Prev_ID = {prev_id}")
                prev_id = u_id
                print(f"After Prev_ID = {prev_id}")
                while not bot.is_closed():
                    await asyncio.sleep(1)
                    r_id = DBC.fetch_db("SELECT r_id FROM reports LEFT JOIN `photos` ON p_report=r_id LEFT JOIN `users` ON u_id=r_owner LEFT JOIN `genus` ON g_common=r_genus WHERE now() GROUP BY r_id ORDER BY r_created DESC LIMIT 1;")
                    p_id = DBC.fetch_db("SELECT MIN(p_id) FROM reports LEFT JOIN `photos` ON p_report=r_id LEFT JOIN `users` ON u_id=r_owner LEFT JOIN `genus` ON g_common=r_genus WHERE now() GROUP BY r_id ORDER BY r_created DESC LIMIT 1;")
                    r_galaxy = DBC.fetch_db("SELECT r_galaxy FROM reports LEFT JOIN `photos` ON p_report=r_id LEFT JOIN `users` ON u_id=r_owner LEFT JOIN `genus` ON g_common=r_genus WHERE now() GROUP BY r_id ORDER BY r_created DESC LIMIT 1;")
                    r_biome = DBC.fetch_db("SELECT r_biome FROM reports LEFT JOIN `photos` ON p_report=r_id LEFT JOIN `users` ON u_id=r_owner LEFT JOIN `genus` ON g_common=r_genus WHERE now() GROUP BY r_id ORDER BY r_created DESC LIMIT 1;")
                    r_created = DBC.fetch_db("SELECT DATE_FORMAT(r_created, '%b %D, %Y') AS r_time FROM reports LEFT JOIN `photos` ON p_report=r_id LEFT JOIN `users` ON u_id=r_owner LEFT JOIN `genus` ON g_common=r_genus WHERE now() GROUP BY r_id ORDER BY r_created DESC LIMIT 1;")
                    r_planet = DBC.fetch_db("SELECT r_planet FROM reports LEFT JOIN `photos` ON p_report=r_id LEFT JOIN `users` ON u_id=r_owner LEFT JOIN `genus` ON g_common=r_genus WHERE now() GROUP BY r_id ORDER BY r_created DESC LIMIT 1;")
                    r_eco = DBC.fetch_db("SELECT r_eco FROM reports LEFT JOIN `photos` ON p_report=r_id LEFT JOIN `users` ON u_id=r_owner LEFT JOIN `genus` ON g_common=r_genus WHERE now() GROUP BY r_id ORDER BY r_created DESC LIMIT 1;")
                    r_activity = DBC.fetch_db("SELECT r_activity FROM reports LEFT JOIN `photos` ON p_report=r_id LEFT JOIN `users` ON u_id=r_owner LEFT JOIN `genus` ON g_common=r_genus WHERE now() GROUP BY r_id ORDER BY r_created DESC LIMIT 1;")
                    r_rarity = DBC.fetch_db("SELECT r_rarity FROM reports LEFT JOIN `photos` ON p_report=r_id LEFT JOIN `users` ON u_id=r_owner LEFT JOIN `genus` ON g_common=r_genus WHERE now() GROUP BY r_id ORDER BY r_created DESC LIMIT 1;")
                    r_height = DBC.fetch_db("SELECT r_height FROM reports LEFT JOIN `photos` ON p_report=r_id LEFT JOIN `users` ON u_id=r_owner LEFT JOIN `genus` ON g_common=r_genus WHERE now() GROUP BY r_id ORDER BY r_created DESC LIMIT 1;")
                    r_weight = DBC.fetch_db("SELECT r_weight FROM reports LEFT JOIN `photos` ON p_report=r_id LEFT JOIN `users` ON u_id=r_owner LEFT JOIN `genus` ON g_common=r_genus WHERE now() GROUP BY r_id ORDER BY r_created DESC LIMIT 1;")  
                    r_address = DBC.fetch_db("SELECT r_address FROM reports LEFT JOIN `photos` ON p_report=r_id LEFT JOIN `users` ON u_id=r_owner LEFT JOIN `genus` ON g_common=r_genus WHERE now() GROUP BY r_id ORDER BY r_created DESC LIMIT 1;")
                    r_system = DBC.fetch_db("SELECT r_system FROM reports LEFT JOIN `photos` ON p_report=r_id LEFT JOIN `users` ON u_id=r_owner LEFT JOIN `genus` ON g_common=r_genus WHERE now() GROUP BY r_id ORDER BY r_created DESC LIMIT 1;")
                    r_gender = DBC.fetch_db("SELECT r_gender FROM reports LEFT JOIN `photos` ON p_report=r_id LEFT JOIN `users` ON u_id=r_owner LEFT JOIN `genus` ON g_common=r_genus WHERE now() GROUP BY r_id ORDER BY r_created DESC LIMIT 1;")
                    r_gender2 = DBC.fetch_db("SELECT r_gender2 FROM reports LEFT JOIN `photos` ON p_report=r_id LEFT JOIN `users` ON u_id=r_owner LEFT JOIN `genus` ON g_common=r_genus WHERE now() GROUP BY r_id ORDER BY r_created DESC LIMIT 1;")
                    u_username = DBC.fetch_db("SELECT u_username FROM reports LEFT JOIN `photos` ON p_report=r_id LEFT JOIN `users` ON u_id=r_owner LEFT JOIN `genus` ON g_common=r_genus WHERE now() GROUP BY r_id ORDER BY r_created DESC LIMIT 1;")
                    u_console = DBC.fetch_db("SELECT u_console FROM reports LEFT JOIN `photos` ON p_report=r_id LEFT JOIN `users` ON u_id=r_owner LEFT JOIN `genus` ON g_common=r_genus WHERE now() GROUP BY r_id ORDER BY r_created DESC LIMIT 1;")
                    r_genus = DBC.fetch_db("SELECT r_genus FROM reports LEFT JOIN `photos` ON p_report=r_id LEFT JOIN `users` ON u_id=r_owner LEFT JOIN `genus` ON g_common=r_genus WHERE now() GROUP BY r_id ORDER BY r_created DESC LIMIT 1;")
                    r_name = DBC.fetch_db("SELECT r_name FROM reports LEFT JOIN `photos` ON p_report=r_id LEFT JOIN `users` ON u_id=r_owner LEFT JOIN `genus` ON g_common=r_genus WHERE now() GROUP BY r_id ORDER BY r_created DESC LIMIT 1;")
                    r_desc = DBC.fetch_db("SELECT r_desc FROM reports LEFT JOIN `photos` ON p_report=r_id LEFT JOIN `users` ON u_id=r_owner LEFT JOIN `genus` ON g_common=r_genus WHERE now() GROUP BY r_id ORDER BY r_created DESC LIMIT 1;")      
                    r_tameable = DBC.fetch_db("SELECT r_tameable FROM reports LEFT JOIN `photos` ON p_report=r_id LEFT JOIN `users` ON u_id=r_owner LEFT JOIN `genus` ON g_common=r_genus WHERE now() GROUP BY r_id ORDER BY r_created DESC LIMIT 1;")      
                    r_color = DBC.fetch_db("SELECT r_color FROM reports LEFT JOIN `photos` ON p_report=r_id LEFT JOIN `users` ON u_id=r_owner LEFT JOIN `genus` ON g_common=r_genus WHERE now() GROUP BY r_id ORDER BY r_created DESC LIMIT 1;")
                    r_color2 = DBC.fetch_db("SELECT r_color2 FROM reports LEFT JOIN `photos` ON p_report=r_id LEFT JOIN `users` ON u_id=r_owner LEFT JOIN `genus` ON g_common=r_genus WHERE now() GROUP BY r_id ORDER BY r_created DESC LIMIT 1;")
                    r_mod1name = DBC.fetch_db("SELECT m_mod FROM reports, mods, users WHERE r_mod1=m_name GROUP BY r_id ORDER BY r_created DESC LIMIT 1;")
                    r_mod1 = DBC.fetch_db("SELECT r_mod1 FROM reports, mods, users WHERE r_mod1=m_name GROUP BY r_id ORDER BY r_created DESC LIMIT 1;")
                    r_mod2name = DBC.fetch_db("SELECT m_mod FROM reports, mods, users WHERE r_mod2=m_name GROUP BY r_id ORDER BY r_created DESC LIMIT 1;")
                    r_mod2 = DBC.fetch_db("SELECT r_mod2 FROM reports, mods, users WHERE r_mod2=m_name GROUP BY r_id ORDER BY r_created DESC LIMIT 1;")
                    r_mod3name = DBC.fetch_db("SELECT m_mod FROM reports, mods, users WHERE r_mod3=m_name GROUP BY r_id ORDER BY r_created DESC LIMIT 1;")
                    r_mod3 = DBC.fetch_db("SELECT r_mod3 FROM reports, mods, users WHERE r_mod3=m_name GROUP BY r_id ORDER BY r_created DESC LIMIT 1;")
                    r_mod4name = DBC.fetch_db("SELECT m_mod FROM reports, mods, users WHERE r_mod4=m_name GROUP BY r_id ORDER BY r_created DESC LIMIT 1;")
                    r_mod4 = DBC.fetch_db("SELECT r_mod4 FROM reports, mods, users WHERE r_mod4=m_name GROUP BY r_id ORDER BY r_created DESC LIMIT 1;")
                    r_mod5name = DBC.fetch_db("SELECT m_mod FROM reports, mods, users WHERE r_mod5=m_name GROUP BY r_id ORDER BY r_created DESC LIMIT 1;")
                    r_mod5 = DBC.fetch_db("SELECT r_mod5 FROM reports, mods, users WHERE r_mod5=m_name GROUP BY r_id ORDER BY r_created DESC LIMIT 1;")
                    r_depth = DBC.fetch_db("SELECT r_depth FROM reports LEFT JOIN `photos` ON p_report=r_id LEFT JOIN `users` ON u_id=r_owner LEFT JOIN `genus` ON g_common=r_genus WHERE now() GROUP BY r_id ORDER BY r_created DESC LIMIT 1;")
                    r_stomach = DBC.fetch_db("SELECT r_stomach FROM reports LEFT JOIN `photos` ON p_report=r_id LEFT JOIN `users` ON u_id=r_owner LEFT JOIN `genus` ON g_common=r_genus WHERE now() GROUP BY r_id ORDER BY r_created DESC LIMIT 1;")
                    r_wormclass = DBC.fetch_db("SELECT r_wormclass FROM reports LEFT JOIN `photos` ON p_report=r_id LEFT JOIN `users` ON u_id=r_owner LEFT JOIN `genus` ON g_common=r_genus WHERE now() GROUP BY r_id ORDER BY r_created DESC LIMIT 1;")

                    picnone = DBC.fetch_db("SELECT * FROM photos WHERE p_report=''");
                    id = str(r_id).lstrip('(').rstrip(',)')
                    tame = str(r_tameable).lstrip('(').rstrip(',)')
                    genus = str(r_genus).lstrip("('").rstrip("',)")
                    color = str(r_color).lstrip("('").rstrip("',)")
                    color2 = str(r_color2).lstrip("('").rstrip("',)")
                    name = str(r_name).lstrip("('").rstrip("',)")
                    address = str(r_address).lstrip("('").rstrip("',)")
                    system = str(r_system).lstrip("('").rstrip("',)")
                    planet = str(r_planet).lstrip("('").rstrip("',)")
                    galaxy = str(r_galaxy).lstrip("('").rstrip("',)")
                    eco = str(r_eco).lstrip("('").rstrip("',)")
                    rarity = str(r_rarity).lstrip("('").rstrip("',)")
                    activity = str(r_activity).lstrip("('").rstrip("',)")
                    console = str(u_console).lstrip("('").rstrip("',)")
                    username = str(u_username).lstrip("('").rstrip("',)")
                    console = str(u_console).lstrip("('").rstrip("',)")
                    biome = str(r_biome).lstrip("('").rstrip("',)")
                    stomach = str(r_stomach).lstrip("('").rstrip("',)")
                    wormclass = str(r_wormclass).lstrip("('").rstrip("',)")
                    depth = str(r_depth).lstrip("Decimal('").rstrip("',)")
                    gender = str(r_gender).lstrip("('").rstrip("',)")
                    gender2 = str(r_gender2).lstrip("('").rstrip("',)")
                    mod1 = str(r_mod1).lstrip("('").rstrip("',)")
                    mod1name = str(r_mod1name).lstrip("('").rstrip("',)")
                    mod2 = str(r_mod2).lstrip("('").rstrip("',)")
                    mod2name = str(r_mod2name).lstrip("('").rstrip("',)")
                    mod3 = str(r_mod3).lstrip("('").rstrip("',)")
                    mod3name = str(r_mod3name).lstrip("('").rstrip("',)")
                    mod4 = str(r_mod4).lstrip("('").rstrip("',)")
                    mod4name = str(r_mod4name).lstrip("('").rstrip("',)")
                    mod5 = str(r_mod5).lstrip("('").rstrip("',)")
                    mod5name = str(r_mod5name).lstrip("('").rstrip("',)")
                    desc = str(r_desc).lstrip("('").rstrip("',)")
                    date = str(r_created).lstrip("('").rstrip("',)")
                    height = str(r_height).lstrip("Decimal('").rstrip("',)")
                    weight = str(r_weight).lstrip("Decimal('").rstrip("',)")
                    if genus == "":
                        genus = "None"
                    
                    if name == "":
                        name = "None"
                    if address == "":
                        address = "None"
                    if system == "":
                        system = "None"
                    if planet == "":
                        planet = "None"
                    if galaxy == "":
                        galaxy = "None"
                    if eco == "":
                        eco = "None"
                    if gender == "":
                        gender = "None"
                    if gender2 == "":
                        gender2 = "None"
                    if height == "":
                        height = "None"
                    if weight == "":
                        weight = "None"
                    if rarity == "":
                        rarity = "None"
                    if activity == "":
                        activity = "None"
                    if biome == "":
                        biome = "None"
                    if mod1 == "":
                        mod1 = "-----"
                    if mod2 == "":
                        mod2 = "-----"
                    if mod3 == "":
                        mod3 = "-----"
                    if mod4 == "":
                        mod4 = "-----"
                    if mod5 == "":
                        mod5 = "-----"
                    if mod1name == "":
                        mod1name = "-----"
                    if mod2name == "":
                        mod2name = "-----"
                    if mod3name == "":
                        mod3name = "-----"
                    if mod4name == "":
                        mod4name = "-----"
                    if mod5name == "":
                        mod5name = "-----"
                    if wormclass == "":
                        wormclass = "N/A"
                    if depth == "":
                        depth = "???"
                    if stomach == "":
                        stomach = "None"
                    if desc == "":
                        desc = "None"
                    if address[0] == '0':
                        add0 = '<:portal0:1024535501912412180>'
                    if address[1] == '0':
                        add1 = '<:portal0:1024535501912412180>'
                    if address[2] == '0':
                        add2 = '<:portal0:1024535501912412180>'
                    if address[3] == '0':
                        add3 = '<:portal0:1024535501912412180>'
                    if address[4] == '0':
                        add4 = '<:portal0:1024535501912412180>'
                    if address[5] == '0':
                        add5 = '<:portal0:1024535501912412180>'
                    if address[6] == '0':
                        add6 = '<:portal0:1024535501912412180>'
                    if address[7] == '0':
                        add7 = '<:portal0:1024535501912412180>'
                    if address[8] == '0':
                        add8 = '<:portal0:1024535501912412180>'
                    if address[9] == '0':
                        add9 = '<:portal0:1024535501912412180>'
                    if address[10] == '0':
                        add10 = '<:portal0:1024535501912412180>'
                    if address[11] == '0':
                        add11 = '<:portal0:1024535501912412180>'

                    if address[0] == '1':
                        add0 = '<:portal1:1024535502570934344>'
                    if address[1] == '1':
                        add1 = '<:portal1:1024535502570934344>'
                    if address[2] == '1':
                        add2 = '<:portal1:1024535502570934344>'
                    if address[3] == '1':
                        add3 = '<:portal1:1024535502570934344>'
                    if address[4] == '1':
                        add4 = '<:portal1:1024535502570934344>'
                    if address[5] == '1':
                        add5 = '<:portal1:1024535502570934344>'
                    if address[6] == '1':
                        add6 = '<:portal1:1024535502570934344>'
                    if address[7] == '1':
                        add7 = '<:portal1:1024535502570934344>'
                    if address[8] == '1':
                        add8 = '<:portal1:1024535502570934344>'
                    if address[9] == '1':
                        add9 = '<:portal1:1024535502570934344>'
                    if address[10] == '1':
                        add10 = '<:portal1:1024535502570934344>'
                    if address[11] == '1':
                        add11 = '<:portal1:1024535502570934344>'

                    if address[0] == '2':
                        add0 = '<:portal2:1024535504374472714> '
                    if address[1] == '2':
                        add1 = '<:portal2:1024535504374472714> '
                    if address[2] == '2':
                        add2 = '<:portal2:1024535504374472714> '
                    if address[3] == '2':
                        add3 = '<:portal2:1024535504374472714> '
                    if address[4] == '2':
                        add4 = '<:portal2:1024535504374472714> '
                    if address[5] == '2':
                        add5 = '<:portal2:1024535504374472714> '
                    if address[6] == '2':
                        add6 = '<:portal2:1024535504374472714> '
                    if address[7] == '2':
                        add7 = '<:portal2:1024535504374472714> '
                    if address[8] == '2':
                        add8 = '<:portal2:1024535504374472714> '
                    if address[9] == '2':
                        add9 = '<:portal2:1024535504374472714> '
                    if address[10] == '2':
                        add10 = '<:portal2:1024535504374472714> '
                    if address[11] == '2':
                        add11 = '<:portal2:1024535504374472714> '

                    if address[0] == '3':
                        add0 = '<:portal3:1024535505347551252>'
                    if address[1] == '3':
                        add1 = '<:portal3:1024535505347551252>'
                    if address[2] == '3':
                        add2 = '<:portal3:1024535505347551252>'
                    if address[3] == '3':
                        add3 = '<:portal3:1024535505347551252>'
                    if address[4] == '3':
                        add4 = '<:portal3:1024535505347551252>'
                    if address[5] == '3':
                        add5 = '<:portal3:1024535505347551252>'
                    if address[6] == '3':
                        add6 = '<:portal3:1024535505347551252>'
                    if address[7] == '3':
                        add7 = '<:portal3:1024535505347551252>'
                    if address[8] == '3':
                        add8 = '<:portal3:1024535505347551252>'
                    if address[9] == '3':
                        add9 = '<:portal3:1024535505347551252>'
                    if address[10] == '3':
                        add10 = '<:portal3:1024535505347551252>'
                    if address[11] == '3':
                        add11 = '<:portal3:1024535505347551252>'

                    if address[0] == '4':
                        add0 = '<:portal4:1024535506308055070> '
                    if address[1] == '4':
                        add1 = '<:portal4:1024535506308055070> '
                    if address[2] == '4':
                        add2 = '<:portal4:1024535506308055070> '
                    if address[3] == '4':
                        add3 = '<:portal4:1024535506308055070> '
                    if address[4] == '4':
                        add4 = '<:portal4:1024535506308055070> '
                    if address[5] == '4':
                        add5 = '<:portal4:1024535506308055070> '
                    if address[6] == '4':
                        add6 = '<:portal4:1024535506308055070> '
                    if address[7] == '4':
                        add7 = '<:portal4:1024535506308055070> '
                    if address[8] == '4':
                        add8 = '<:portal4:1024535506308055070> '
                    if address[9] == '4':
                        add9 = '<:portal4:1024535506308055070> '
                    if address[10] == '4':
                        add10 = '<:portal4:1024535506308055070> '
                    if address[11] == '4':
                        add11 = '<:portal4:1024535506308055070> '

                    if address[0] == '5':
                        add0 = '<:portal5:1024532199795589181>'
                    if address[1] == '5':
                        add1 = '<:portal5:1024532199795589181>'
                    if address[2] == '5':
                        add2 = '<:portal5:1024532199795589181>'
                    if address[3] == '5':
                        add3 = '<:portal5:1024532199795589181>'
                    if address[4] == '5':
                        add4 = '<:portal5:1024532199795589181>'
                    if address[5] == '5':
                        add5 = '<:portal5:1024532199795589181>'
                    if address[6] == '5':
                        add6 = '<:portal5:1024532199795589181>'
                    if address[7] == '5':
                        add7 = '<:portal5:1024532199795589181>'
                    if address[8] == '5':
                        add8 = '<:portal5:1024532199795589181>'
                    if address[9] == '5':
                        add9 = '<:portal5:1024532199795589181>'
                    if address[10] == '5':
                        add10 = '<:portal5:1024532199795589181>'
                    if address[11] == '5':
                        add11 = '<:portal5:1024532199795589181>'

                    if address[0] == '6':
                        add0 = '<:portal6:1024535507331465317>'
                    if address[1] == '6':
                        add1 = '<:portal6:1024535507331465317>'
                    if address[2] == '6':
                        add2 = '<:portal6:1024535507331465317>'
                    if address[3] == '6':
                        add3 = '<:portal6:1024535507331465317>'
                    if address[4] == '6':
                        add4 = '<:portal6:1024535507331465317>'
                    if address[5] == '6':
                        add5 = '<:portal6:1024535507331465317>'
                    if address[6] == '6':
                        add6 = '<:portal6:1024535507331465317>'
                    if address[7] == '6':
                        add7 = '<:portal6:1024535507331465317>'
                    if address[8] == '6':
                        add8 = '<:portal6:1024535507331465317>'
                    if address[9] == '6':
                        add9 = '<:portal6:1024535507331465317>'
                    if address[10] == '6':
                        add10 = '<:portal6:1024535507331465317>'
                    if address[11] == '6':
                        add11 = '<:portal6:1024535507331465317>'

                    if address[0] == '7':
                        add0 = '<:portal7:1024535508434559046>'
                    if address[1] == '7':
                        add1 = '<:portal7:1024535508434559046>'
                    if address[2] == '7':
                        add2 = '<:portal7:1024535508434559046>'
                    if address[3] == '7':
                        add3 = '<:portal7:1024535508434559046>'
                    if address[4] == '7':
                        add4 = '<:portal7:1024535508434559046>'
                    if address[5] == '7':
                        add5 = '<:portal7:1024535508434559046>'
                    if address[6] == '7':
                        add6 = '<:portal7:1024535508434559046>'
                    if address[7] == '7':
                        add7 = '<:portal7:1024535508434559046>'
                    if address[8] == '7':
                        add8 = '<:portal7:1024535508434559046>'
                    if address[9] == '7':
                        add9 = '<:portal7:1024535508434559046>'
                    if address[10] == '7':
                        add10 = '<:portal7:1024535508434559046>'
                    if address[11] == '7':
                        add11 = '<:portal7:1024535508434559046>'

                    if address[0] == '8':
                        add0 = '<:portal8:1024535509575417886>'
                    if address[1] == '8':
                        add1 = '<:portal8:1024535509575417886>'
                    if address[2] == '8':
                        add2 = '<:portal8:1024535509575417886>'
                    if address[3] == '8':
                        add3 = '<:portal8:1024535509575417886>'
                    if address[4] == '8':
                        add4 = '<:portal8:1024535509575417886>'
                    if address[5] == '8':
                        add5 = '<:portal8:1024535509575417886>'
                    if address[6] == '8':
                        add6 = '<:portal8:1024535509575417886>'
                    if address[7] == '8':
                        add7 = '<:portal8:1024535509575417886>'
                    if address[8] == '8':
                        add8 = '<:portal8:1024535509575417886>'
                    if address[9] == '8':
                        add9 = '<:portal8:1024535509575417886>'
                    if address[10] == '8':
                        add10 = '<:portal8:1024535509575417886>'
                    if address[11] == '8':
                        add11 = '<:portal8:1024535509575417886>'

                    if address[0] == '9':
                        add0 = '<:portal9:1024535510468800522>'
                    if address[1] == '9':
                        add1 = '<:portal9:1024535510468800522>'
                    if address[2] == '9':
                        add2 = '<:portal9:1024535510468800522>'
                    if address[3] == '9':
                        add3 = '<:portal9:1024535510468800522>'
                    if address[4] == '9':
                        add4 = '<:portal9:1024535510468800522>'
                    if address[5] == '9':
                        add5 = '<:portal9:1024535510468800522>'
                    if address[6] == '9':
                        add6 = '<:portal9:1024535510468800522>'
                    if address[7] == '9':
                        add7 = '<:portal9:1024535510468800522>'
                    if address[8] == '9':
                        add8 = '<:portal9:1024535510468800522>'
                    if address[9] == '9':
                        add9 = '<:portal9:1024535510468800522>'
                    if address[10] == '9':
                        add10 = '<:portal9:1024535510468800522>'
                    if address[11] == '9':
                        add11 = '<:portal9:1024535510468800522>'

                    if address[0] == 'A':
                        add0 = '<:portala:1024535514658906162>'
                    if address[1] == 'A':
                        add1 = '<:portala:1024535514658906162>'
                    if address[2] == 'A':
                        add2 = '<:portala:1024535514658906162>'
                    if address[3] == 'A':
                        add3 = '<:portala:1024535514658906162>'
                    if address[4] == 'A':
                        add4 = '<:portala:1024535514658906162>'
                    if address[5] == 'A':
                        add5 = '<:portala:1024535514658906162>'
                    if address[6] == 'A':
                        add6 = '<:portala:1024535514658906162>'
                    if address[7] == 'A':
                        add7 = '<:portala:1024535514658906162>'
                    if address[8] == 'A':
                        add8 = '<:portala:1024535514658906162>'
                    if address[9] == 'A':
                        add9 = '<:portala:1024535514658906162>'
                    if address[10] == 'A':
                        add10 = '<:portala:1024535514658906162>'
                    if address[11] == 'A':
                        add11 = '<:portala:1024535514658906162>'

                    if address[0] == 'a':
                        add0 = '<:portala:1024535514658906162>'
                    if address[1] == 'a':
                        add1 = '<:portala:1024535514658906162>'
                    if address[2] == 'a':
                        add2 = '<:portala:1024535514658906162>'
                    if address[3] == 'a':
                        add3 = '<:portala:1024535514658906162>'
                    if address[4] == 'a':
                        add4 = '<:portala:1024535514658906162>'
                    if address[5] == 'a':
                        add5 = '<:portala:1024535514658906162>'
                    if address[6] == 'a':
                        add6 = '<:portala:1024535514658906162>'
                    if address[7] == 'a':
                        add7 = '<:portala:1024535514658906162>'
                    if address[8] == 'a':
                        add8 = '<:portala:1024535514658906162>'
                    if address[9] == 'a':
                        add9 = '<:portala:1024535514658906162>'
                    if address[10] == 'a':
                        add10 = '<:portala:1024535514658906162>'
                    if address[11] == 'a':
                        add11 = '<:portala:1024535514658906162>'

                    if address[0] == 'B':
                        add0 = '<:portalb:1024535515728445470>'
                    if address[1] == 'B':
                        add1 = '<:portalb:1024535515728445470>'
                    if address[2] == 'B':
                        add2 = '<:portalb:1024535515728445470>'
                    if address[3] == 'B':
                        add3 = '<:portalb:1024535515728445470>'
                    if address[4] == 'B':
                        add4 = '<:portalb:1024535515728445470>'
                    if address[5] == 'B':
                        add5 = '<:portalb:1024535515728445470>'
                    if address[6] == 'B':
                        add6 = '<:portalb:1024535515728445470>'
                    if address[7] == 'B':
                        add7 = '<:portalb:1024535515728445470>'
                    if address[8] == 'B':
                        add8 = '<:portalb:1024535515728445470>'
                    if address[9] == 'B':
                        add9 = '<:portalb:1024535515728445470>'
                    if address[10] == 'B':
                        add10 = '<:portalb:1024535515728445470>'
                    if address[11] == 'B':
                        add11 = '<:portalb:1024535515728445470>'

                    if address[0] == 'b':
                        add0 = '<:portalb:1024535515728445470>'
                    if address[1] == 'b':
                        add1 = '<:portalb:1024535515728445470>'
                    if address[2] == 'b':
                        add2 = '<:portalb:1024535515728445470>'
                    if address[3] == 'b':
                        add3 = '<:portalb:1024535515728445470>'
                    if address[4] == 'b':
                        add4 = '<:portalb:1024535515728445470>'
                    if address[5] == 'b':
                        add5 = '<:portalb:1024535515728445470>'
                    if address[6] == 'b':
                        add6 = '<:portalb:1024535515728445470>'
                    if address[7] == 'b':
                        add7 = '<:portalb:1024535515728445470>'
                    if address[8] == 'b':
                        add8 = '<:portalb:1024535515728445470>'
                    if address[9] == 'b':
                        add9 = '<:portalb:1024535515728445470>'
                    if address[10] == 'b':
                        add10 = '<:portalb:1024535515728445470>'
                    if address[11] == 'b':
                        add11 = '<:portalb:1024535515728445470>'

                    if address[0] == 'C':
                        add0 = '<:portalc:1024535516642803712>'
                    if address[1] == 'C':
                        add1 = '<:portalc:1024535516642803712>'
                    if address[2] == 'C':
                        add2 = '<:portalc:1024535516642803712>'
                    if address[3] == 'C':
                        add3 = '<:portalc:1024535516642803712>'
                    if address[4] == 'C':
                        add4 = '<:portalc:1024535516642803712>'
                    if address[5] == 'C':
                        add5 = '<:portalc:1024535516642803712>'
                    if address[6] == 'C':
                        add6 = '<:portalc:1024535516642803712>'
                    if address[7] == 'C':
                        add7 = '<:portalc:1024535516642803712>'
                    if address[8] == 'C':
                        add8 = '<:portalc:1024535516642803712>'
                    if address[9] == 'C':
                        add9 = '<:portalc:1024535516642803712>'
                    if address[10] == 'C':
                        add10 = '<:portalc:1024535516642803712>'
                    if address[11] == 'C':
                        add11 = '<:portalc:1024535516642803712>'

                    if address[0] == 'c':
                        add0 = '<:portalc:1024535516642803712>'
                    if address[1] == 'c':
                        add1 = '<:portalc:1024535516642803712>'
                    if address[2] == 'c':
                        add2 = '<:portalc:1024535516642803712>'
                    if address[3] == 'c':
                        add3 = '<:portalc:1024535516642803712>'
                    if address[4] == 'c':
                        add4 = '<:portalc:1024535516642803712>'
                    if address[5] == 'c':
                        add5 = '<:portalc:1024535516642803712>'
                    if address[6] == 'c':
                        add6 = '<:portalc:1024535516642803712>'
                    if address[7] == 'c':
                        add7 = '<:portalc:1024535516642803712>'
                    if address[8] == 'c':
                        add8 = '<:portalc:1024535516642803712>'
                    if address[9] == 'c':
                        add9 = '<:portalc:1024535516642803712>'
                    if address[10] == 'c':
                        add10 = '<:portalc:1024535516642803712>'
                    if address[11] == 'c':
                        add11 = '<:portalc:1024535516642803712>'

                    if address[0] == 'D':
                        add0 = '<:portald:1024535517368426509>'
                    if address[1] == 'D':
                        add1 = '<:portald:1024535517368426509>'
                    if address[2] == 'D':
                        add2 = '<:portald:1024535517368426509>'
                    if address[3] == 'D':
                        add3 = '<:portald:1024535517368426509>'
                    if address[4] == 'D':
                        add4 = '<:portald:1024535517368426509>'
                    if address[5] == 'D':
                        add5 = '<:portald:1024535517368426509>'
                    if address[6] == 'D':
                        add6 = '<:portald:1024535517368426509>'
                    if address[7] == 'D':
                        add7 = '<:portald:1024535517368426509>'
                    if address[8] == 'D':
                        add8 = '<:portald:1024535517368426509>'
                    if address[9] == 'D':
                        add9 = '<:portald:1024535517368426509>'
                    if address[10] == 'D':
                        add10 = '<:portald:1024535517368426509>'
                    if address[11] == 'D':
                        add11 = '<:portald:1024535517368426509>'

                    if address[0] == 'd':
                        add0 = '<:portald:1024535517368426509>'
                    if address[1] == 'd':
                        add1 = '<:portald:1024535517368426509>'
                    if address[2] == 'd':
                        add2 = '<:portald:1024535517368426509>'
                    if address[3] == 'd':
                        add3 = '<:portald:1024535517368426509>'
                    if address[4] == 'd':
                        add4 = '<:portald:1024535517368426509>'
                    if address[5] == 'd':
                        add5 = '<:portald:1024535517368426509>'
                    if address[6] == 'd':
                        add6 = '<:portald:1024535517368426509>'
                    if address[7] == 'd':
                        add7 = '<:portald:1024535517368426509>'
                    if address[8] == 'd':
                        add8 = '<:portald:1024535517368426509>'
                    if address[9] == 'd':
                        add9 = '<:portald:1024535517368426509>'
                    if address[10] == 'd':
                        add10 = '<:portald:1024535517368426509>'
                    if address[11] == 'd':
                        add11 = '<:portald:1024535517368426509>'

                    if address[0] == 'E':
                        add0 = '<:portale:1024535518555410442>'
                    if address[1] == 'E':
                        add1 = '<:portale:1024535518555410442>'
                    if address[2] == 'E':
                        add2 = '<:portale:1024535518555410442>'
                    if address[3] == 'E':
                        add3 = '<:portale:1024535518555410442>'
                    if address[4] == 'E':
                        add4 = '<:portale:1024535518555410442>'
                    if address[5] == 'E':
                        add5 = '<:portale:1024535518555410442>'
                    if address[6] == 'E':
                        add6 = '<:portale:1024535518555410442>'
                    if address[7] == 'E':
                        add7 = '<:portale:1024535518555410442>'
                    if address[8] == 'E':
                        add8 = '<:portale:1024535518555410442>'
                    if address[9] == 'E':
                        add9 = '<:portale:1024535518555410442>'
                    if address[10] == 'E':
                        add10 = '<:portale:1024535518555410442>'
                    if address[11] == 'E':
                        add11 = '<:portale:1024535518555410442>'

                    if address[0] == 'e':
                        add0 = '<:portale:1024535518555410442>'
                    if address[1] == 'e':
                        add1 = '<:portale:1024535518555410442>'
                    if address[2] == 'e':
                        add2 = '<:portale:1024535518555410442>'
                    if address[3] == 'e':
                        add3 = '<:portale:1024535518555410442>'
                    if address[4] == 'e':
                        add4 = '<:portale:1024535518555410442>'
                    if address[5] == 'e':
                        add5 = '<:portale:1024535518555410442>'
                    if address[6] == 'e':
                        add6 = '<:portale:1024535518555410442>'
                    if address[7] == 'e':
                        add7 = '<:portale:1024535518555410442>'
                    if address[8] == 'e':
                        add8 = '<:portale:1024535518555410442>'
                    if address[9] == 'e':
                        add9 = '<:portale:1024535518555410442>'
                    if address[10] == 'e':
                        add10 = '<:portale:1024535518555410442>'
                    if address[11] == 'e':
                        add11 = '<:portale:1024535518555410442>'

                    if address[0] == 'F':
                        add0 = '<:portalf:1024535519465582593>'
                    if address[1] == 'F':
                        add1 = '<:portalf:1024535519465582593>'
                    if address[2] == 'F':
                        add2 = '<:portalf:1024535519465582593>'
                    if address[3] == 'F':
                        add3 = '<:portalf:1024535519465582593>'
                    if address[4] == 'F':
                        add4 = '<:portalf:1024535519465582593>'
                    if address[5] == 'F':
                        add5 = '<:portalf:1024535519465582593>'
                    if address[6] == 'F':
                        add6 = '<:portalf:1024535519465582593>'
                    if address[7] == 'F':
                        add7 = '<:portalf:1024535519465582593>'
                    if address[8] == 'F':
                        add8 = '<:portalf:1024535519465582593>'
                    if address[9] == 'F':
                        add9 = '<:portalf:1024535519465582593>'
                    if address[10] == 'F':
                        add10 = '<:portalf:1024535519465582593>'
                    if address[11] == 'F':
                        add11 = '<:portalf:1024535519465582593>'

                    if address[0] == 'f':
                        add0 = '<:portalf:1024535519465582593>'
                    if address[1] == 'f':
                        add1 = '<:portalf:1024535519465582593>'
                    if address[2] == 'f':
                        add2 = '<:portalf:1024535519465582593>'
                    if address[3] == 'f':
                        add3 = '<:portalf:1024535519465582593>'
                    if address[4] == 'f':
                        add4 = '<:portalf:1024535519465582593>'
                    if address[5] == 'f':
                        add5 = '<:portalf:1024535519465582593>'
                    if address[6] == 'f':
                        add6 = '<:portalf:1024535519465582593>'
                    if address[7] == 'f':
                        add7 = '<:portalf:1024535519465582593>'
                    if address[8] == 'f':
                        add8 = '<:portalf:1024535519465582593>'
                    if address[9] == 'f':
                        add9 = '<:portalf:1024535519465582593>'
                    if address[10] == 'f':
                        add10 = '<:portalf:1024535519465582593>'
                    if address[11] == 'f':
                        add11 = '<:portalf:1024535519465582593>'

                    if tame == '0':
                        tameable = '<:notame:1024547622486286356>'
                    if tame == '1':
                        tameable = '<:tame:1024547623320965170>'

                    if color == 'Red':
                        clr = '<:red:1024553594290176020>'
                    if color == 'Orange':
                        clr = '<:orange:1024553591517749298> '
                    if color == 'Yellow':
                        clr = '<:yellow:1024553598048276480>'
                    if color == 'Green':
                        clr = '<:green:1024553589634502706>'
                    if color == 'Teal':
                        clr = '<:teal:1024553595108077609>'
                    if color == 'Blue':
                        clr = '<:blue:1024553819016806500>'
                    if color == 'Purple':
                        clr = '<:purple:1024553593262592091>'
                    if color == 'Pink':
                        clr = '<:pink:1024553592306270219>'
                    if color == 'Brown':
                        clr = '<:brown:1024553819809513472>'
                    if color == 'White':
                        clr = '<:white:1024553596819341312>'
                    if color == 'Gray':
                        clr = '<:gray:1024553588430737428>'
                    if color == 'Black':
                        clr = '<:black:1024553818219892786>'
                    if color== '':
                        clr = '<:none:1024553590523691048>'
                    
                    if color2 == 'Red':
                        clr2 = '<:red:1024553594290176020>'
                    if color2 == 'Orange':
                        clr2 = '<:orange:1024553591517749298> '
                    if color2 == 'Yellow':
                        clr2 = '<:yellow:1024553598048276480>'
                    if color2 == 'Green':
                        clr2 = '<:green:1024553589634502706>'
                    if color2== 'Teal':
                        clr2 = '<:teal:1024553595108077609>'
                    if color2== 'Blue':
                        clr2 = '<:blue:1024553819016806500>'
                    if color2== 'Purple':
                        clr2 = '<:purple:1024553593262592091>'
                    if color2== 'Pink':
                        clr2 = '<:pink:1024553592306270219>'
                    if color2== 'Brown':
                        clr2 = '<:brown:1024553819809513472>'
                    if color2== 'White':
                        clr2 = '<:white:1024553596819341312>'
                    if color2== 'Gray':
                        clr2 = '<:gray:1024553588430737428>'
                    if color2== 'Black':
                        clr2 = '<:black:1024553818219892786>'
                    if color2== 'None':
                        clr2 = '<:none:1024553590523691048>'
                    if color2== 'Transparent':
                        clr2 = '<:transparent:1024553595976306760>'
                    if color2== '':
                        clr2 = '<:none:1024553590523691048>'

                    print(f'{address[0]}{address[1]}{address[2]}{address[3]}{address[4]}{address[5]}{address[6]}{address[7]}{address[8]}{address[9]}{address[10]}{address[11]}')
                    print(f'({id}) - {tame} {name} ({genus}) at {address} in {system} System. Recorded by {username} ({console})')
                    embedVar = discord.Embed(title=f'{tameable} {name}', url='https://www.faunalog.com/viewreport.php?r_id='+str(r_id).lstrip('(').rstrip(',)'), description=f'{add0}{add1}{add2}{add3}{add4}{add5}{add6}{add7}{add8}{add9}{add10}{add11} \n \n Genus {genus} \n {biome} Biome \n {rarity} / {eco} / {activity} \n Galaxy: **{galaxy}** - System: **{system}** - Planet: **{planet}** \n Weight: **{weight}** kg - Height: **{height}** m \n Primary Color: {clr} Secondary Color: {clr2}', color=0x00000)
                    embedVar.add_field(name=f'Description', value=f'{desc}', inline=False)
                    
                    if (picnone == ''):
                        embedVar.set_image(url="https://www.faunalog.com/images/nophoto.png")
                    else:
                        embedVar.set_image(url="https://www.faunalog.com/photos/"+str(r_id).lstrip('(').rstrip(',)')+"-"+str(p_id).lstrip('(').rstrip(',)')+".jpg")

                    embedVar.set_footer(text=f'Report #{id} - Discovered by {username} on {date}')
                    if eco == 'Terrestrial':
                        c = bot.get_channel(1001884916776177674)
                    if eco == 'Aquatic':
                        c = bot.get_channel(1001884957049897031)
                    if eco == 'Aerial':
                        c = bot.get_channel(1001884989073395842)
                    if eco == 'Subterranean':
                        c = bot.get_channel(1021942279042244608)
                    if genus == 'Shaihuluda - Sandworm':
                        c = bot.get_channel(1037949665917812856)
                        embedVar = discord.Embed(title=f'{name}', url='https://www.faunalog.com/viewreportworm.php?r_id='+str(r_id).lstrip('(').rstrip(',)'), description=f'{add0}{add1}{add2}{add3}{add4}{add5}{add6}{add7}{add8}{add9}{add10}{add11} \n \n Genus {genus} \n Class: **{wormclass}** \n\n Galaxy: **{galaxy}** - System: **{system}**  - Planet: **{planet}** \n \n Max Depth: **{depth}** ku \n Stomach Contents:  **{stomach}**', color=0x00000)
                        if (picnone == ''):
                            embedVar.set_image(url="https://www.faunalog.com/images/nophoto.png")
                        else:
                            embedVar.set_image(url="https://www.faunalog.com/photos/"+str(r_id).lstrip('(').rstrip(',)')+"-"+str(p_id).lstrip('(').rstrip(',)')+".jpg")
                    
                    if genus == 'Spatibalaenae - Space Whale':
                        c = bot.get_channel(1037603874057502750)
                        embedVar = discord.Embed(title=f'{name}', url='https://www.faunalog.com/viewreportda.php?r_id='+str(r_id).lstrip('(').rstrip(',)'), description=f'{add0}{add1}{add2}{add3}{add4}{add5}{add6}{add7}{add8}{add9}{add10}{add11} \n \n Genus {genus} \n Galaxy: **{galaxy}** - System: **{system}** \n \n {mod1} - {mod1name}\n {mod2} - {mod2name}\n {mod3} - {mod3name}\n {mod4} - {mod4name}\n {mod5} - {mod5name} ', color=0x00000)
                        if (picnone == ''):
                            embedVar.set_image(url="https://www.faunalog.com/images/nophoto.png")
                        else:
                            embedVar.set_image(url="https://www.faunalog.com/photos/"+str(r_id).lstrip('(').rstrip(',)')+"-"+str(p_id).lstrip('(').rstrip(',)')+".jpg")
                    await c.send(embed=embedVar)
                    break
            else:
                pass
            if u_id < prev_id:
                print('Correcting Deleted Reports...')
                print(f"U_ID = {u_id}")
                print(f"Prev_ID = {prev_id}")
                prev_id = u_id
                print(f"After Prev_ID = {prev_id}")    
    while False:       
        pass    



###########################################################################
# Below cogs represents our folder our cogs are in. Following is the file name. So 'meme.py' in cogs, would be cogs.meme
# Think of it like a dot path import
# bot.remove_command('help')

# initial_extensions = ['cogs.help',
#                       'cogs.planetgen',
#                       'cogs.systemgen',
#                       'cogs.faunagen',
#                       'cogs.floragen',
#                       'cogs.multitools',
#                       'cogs.rolls',
#                       'cogs.npcgen',
#                       'cogs.sheet',
#                       'cogs.namegen',
#                       'cogs.charsheet',
#                       'cogs.economy',
#                       'cogs.friend'
#                       ]



# @bot.command()
# @commands.is_owner()
# async def reload(ctx, *, msg):
#     """Load a module."""
#     await ctx.message.delete()
#     try:
#         if os.path.exists("cogs/{}.py".format(msg)):
#             bot.reload_extension("cogs.{}".format(msg))
#         elif os.path.exists("cogs/{}.py".format(msg)):
#             bot.reload_extension("cogs.{}".format(msg))
#         else:
#             raise ImportError("No module named '{}'".format(msg))
#     except Exception as e:
#         await ctx.send('Failed to reload module: `{}.py`'.format(msg))
#         await ctx.send('{}: {}'.format(type(e).__name__, e))
#     else:
#         await ctx.send('Reloaded module: `{}.py`'.format(msg))

###############################bot  commands###############################
@bot.event
async def on_ready():
    print("Connection established")
        
######################################################
bot.loop.create_task(run())
bot.run(token)