async def raid(ctx, arg, arg2, arg3, arg4):#arg = gym name, arg2 = pokemon name, arg3 = level, arg4 = time remaining if ctx and ctx.message.channel.id == str(bot_channel): pokemon_id = find_pokemon_id(str(arg2).capitalize()) time = get_time(int(arg4)) try: cursor.execute("SELECT id FROM forts WHERE NAME LIKE '" + str(arg) + "%';") gym_id = str(cursor.fetchall()) gym_id = gym_id.split(',') gym_id = gym_id[0].split('((') cursor.execute("INSERT INTO raids(" "id, external_id, fort_id , level, " "pokemon_id, move_1, move_2, time_spawn, " "time_battle, time_end, cp)" "VALUES " "(null, null, " + str(gym_id[1]) + ", " + str(arg3) + ", " + str(pokemon_id) + ", null, null, " "null, null, " + str(time) + ", null);") database.commit() await bot.say('Successfully added your raid to the live map.') await bot.send_message(discord.Object(id=log_channel), str(ctx.message.author.name) + ' said there was a ' + str(arg2) + ' raid going on at ' + str(arg)) and print(str(ctx.message.author.name) + ' said there was a ' + str(arg2) + ' raid going on at ' + str(arg)) except: database.rollback() await bot.say('Unsuccesful in database query, your raid was not added to the live map.')
async def raid( ctx, arg, arg2, arg3, arg4 ): #arg = gym name, arg2 = pokemon name, arg3 = level, arg4 = time remaining if ctx and ctx.message.channel.id == str(bot_channel) and str( arg2).lower() in pokemon: pokemon_id = find_pokemon_id(str(arg2).capitalize()) time = get_time(int(arg4)) try: cursor.execute("SELECT id FROM forts WHERE NAME LIKE '" + str(arg) + "%';") gym_id = str(cursor.fetchall()) gym_id = gym_id.split(',') gym_id = gym_id[0].split('((') cursor.execute("INSERT INTO raids(" "id, external_id, fort_id , level, " "pokemon_id, move_1, move_2, time_spawn, " "time_battle, time_end, cp)" "VALUES " "(null, null, " + str(gym_id[1]) + ", " + str(arg3) + ", " + str(pokemon_id) + ", null, null, " "null, null, " + str(time) + ", null);") database.commit() await bot.say('Successfully added your raid to the live map.') await bot.send_message( discord.Object(id=log_channel), str(ctx.message.author.name) + ' said there was a ' + str(arg2) + ' raid going on at ' + str(arg)) and print( str(ctx.message.author.name) + ' said there was a ' + str(arg2) + ' raid going on at ' + str(arg)) except: database.rollback() await bot.say( 'Unsuccesful in database query, your raid was not added to the live map.' )
async def spawn(ctx, arg, arg2, arg3): if ctx and ctx.message.channel.id == str(bot_channel) and str( arg).lower() in pokemon: pokemon_id = find_pokemon_id(str(arg).capitalize()) time = get_time(15) try: cursor.execute( "INSERT INTO sightings(" "id, pokemon_id, spawn_id, expire_timestamp, encounter_id, lat, lon, " "atk_iv, def_iv, sta_iv, move_1, move_2, gender, " "form, cp, level, updated, weather_boosted_condition, weather_cell_id, weight) " "VALUES (null, %s, null, %s, null, %s , %s" ", null, null, null, null, null, null," " null, null, null, null, null, null, null);", (str(pokemon_id), str(time), str(arg2), str(arg3))) database.commit() await bot.say( 'Successfully added your spawn to the live map.\n' '*Pokemon timers are automatically given 15 minutes since the timer is unknown.*' ) await bot.send_message( discord.Object(id=log_channel), str(ctx.message.author.name) + ' said there was a wild ' + str(arg) + ' at these coordinates: ' + str(arg2) + ', ' + str(arg3)) and print( str(ctx.message.author.name) + ' said there was a wild ' + str(arg) + ' at these coordinates: ' + str(arg2) + ', ' + str(arg3)) except: tb = traceback.print_exc(file=sys.stdout) print(tb) await bot.say( 'Unsuccessful in database query, your reported spawn was not added to the live map.' )
async def spawn(ctx, arg, arg2, arg3): if ctx and ctx.message.channel.id == str(bot_channel) and arg in pokemon: pokemon_id = find_pokemon_id(str(arg).capitalize()) time = datetime.datetime.utcnow() + timedelta(minutes=15) time2 = datetime.datetime.utcnow() + timedelta() number = random.randint(1,2000000001) try: cursor.execute("REPLACE INTO pokemon(encounter_id, spawnpoint_id, pokemon_id, latitude, longitude, disappear_time, individual_attack, individual_defense, individual_stamina, move_1, move_2, cp, cp_multiplier, weight, height, gender, costume, form, weather_boosted_condition, last_modified)" "VALUES ("+str(number)+", "+str(number)+", "+str(pokemon_id)+", "+str(arg2)+", "+str(arg3)+", '"+str(time)+"', null, null, null, null, null, null, null, null, null, null, null, null, null, '"+str(time2)+"');") database.ping(True) database.commit() await bot.say('Successfully added your spawn to the live map.\n' '*Pokemon timers are automatically given 15 minutes since the timer is unknown.*') #await bot.say("VALUES ("+str(number)+", "+str(number)+", "+str(pokemon_id)+", "+str(arg2)+", "+str(arg3)+", '"+str(time)+"', null, null, null, null, null, null, null, null, null, null, null, null, null, null);") await bot.send_message(discord.Object(id=log_channel), str(ctx.message.author.name) + ' said there was a wild ' + str(arg) + ' at these coordinates: ' + str(arg2) + ', ' + str(arg3)) and print(str(ctx.message.author.name) + ' said there was a wild ' + str(arg) + ' at these coordinates: ' + str(arg2) + ', ' + str(arg3)) spawn_embed=discord.Embed( title='Click for directions!', url=("https://www.google.com/maps/?q=" + str(arg2) + "," + str(arg3)), description=('A wild ' + str(arg).capitalize() + ' is available!\n\n' '**Time Remaining:** ~15 minutes.\n' '**Spotted by:** ' + str(ctx.message.author.name) + '!'), color=3447003 ) spawn_embed.set_image(url="http://www.pokestadium.com/sprites/xy/" + str(arg).lower() + ".gif") await bot.send_message(discord.Object(id=spawn_channel), embed=spawn_embed) except: tb = traceback.print_exc(file=sys.stdout) print(tb) await bot.say("VALUES ("+str(number)+", "+str(number)+", "+str(pokemon_id)+", "+str(arg2)+", "+str(arg3)+", '"+str(time)+"', null, null, null, null, null, null, null, null, null, null, null, null, null, null);") await bot.say('Unsuccessful in database query, your reported spawn was not added to the live map.')
async def incubate(ctx, gym_id, remaining_time): channel = discord.Object(id=bot_channel) current_time = datetime.datetime.utcnow() current_epoch_time = calendar.timegm(current_time.timetuple()) sleep_time = remaining_time - current_epoch_time await bot.send_message( channel, '*Incubating Egg at Gym ID: ' + str(gym_id) + '. Will auto hatch in **' + str(sleep_time) + '** seconds.*') print('Auto-incubating Legendary egg at Gym ID: ' + str(gym_id) + '. Will auto hatch in ' + str(sleep_time) + ' seconds.') # Let's pause this thread until hatch time await asyncio.sleep(sleep_time) # Need to check if egg still exists before updating it and posting. Otherwise, someone may have deleted it. cursor.execute("SELECT id FROM raids WHERE fort_id='" + str(gym_id) + "' AND time_end>'" + str(current_epoch_time) + "';") raid_check = cursor.rowcount if (raid_check == 1): cursor.execute("UPDATE raids SET pokemon_id='" + str(legendary_id) + "' WHERE fort_id='" + str(gym_id) + "' AND time_end>'" + str(current_epoch_time) + "';") database.commit() cursor.execute( "SELECT f.id, f.name, f.lat, f.lon, fs.team, r.level, r.pokemon_id, r.time_end FROM forts f JOIN raids r ON f.id=r.fort_id JOIN fort_sightings fs ON f.id = fs.fort_id WHERE f.id='" + str(gym_id) + "' AND r.time_end>'" + str(current_epoch_time) + "';") raid_data = cursor.fetchall() gym_id, gym_name, gym_lat, gym_lon, gym_team_id, raid_level, raid_pokemon_id, time_end = raid_data[ 0] await bot.send_message( channel, 'Auto updated **Legendary Egg to ' + str(pokejson[str(raid_pokemon_id)]) + ' Raid' + '**' + '\nGym: **' + str(gym_id) + ': ' + str(gym_name) + ' Gym' + '**' + '\nRaid Ends: **' + str(time.strftime('%I:%M %p', time.localtime(time_end))) + '**') print('Legendary egg at Gym ID: ' + str(gym_id) + ' hatched into ' + str(pokejson[str(raid_pokemon_id)])) raid_embed = discord.Embed( title='**Level ' + str(raid_level) + ' ' + str(pokejson[str(raid_pokemon_id)]) + ' Raid**', description='Gym: **' + str(gym_name) + ' Gym**' + '\nRaid Ends: **' + str(time.strftime('%I:%M %p', time.localtime(time_end))) + '**' + '\nReported by: __' + str(ctx.message.author.name) + '__' + '\n\nhttps://www.google.com/maps?q=loc:' + str(gym_lat) + ',' + str(gym_lon), color=get_team_color(gym_team_id)) thumbnail_image_url = 'https://bitbucket.org/anzmap/sprites/raw/HEAD/' + str( raid_pokemon_id) + '.png' raid_embed.set_thumbnail(url=thumbnail_image_url) await bot.send_message(discord.Object(id=log_channel), embed=raid_embed) else: print( 'Auto-hatch cancelled. Egg was not found, possibly deleted before hatch.' )
async def gym(ctx, arg): cursor.execute("SELECT name FROM gymdetails WHERE name LIKE '" + str(arg) + "%';") gym_name = str(cursor.fetchall()) msg = "`{}`".format(gym_name) database.commit() await bot.say(msg)
async def list(ctx, *, raw_gym_name): if ctx and ((ctx.message.channel.id == str(bot_channel)) or ((ctx.message.channel.id == str(admin_channel)))): database.ping(True) try: if raw_gym_name.isnumeric(): cursor.execute( "SELECT id, name, lat, lon FROM forts WHERE id LIKE '" + str(raw_gym_name) + "';") else: cursor.execute( "SELECT id, name, lat, lon FROM forts WHERE name LIKE '%" + str(raw_gym_name) + "%';") data = cursor.fetchall() count = cursor.rowcount gym_names = '' for gym in data: gym_names += str(gym[0]) + ': ' + gym[ 1] + ' <https://www.google.com/maps?q=loc:' + str( gym[2]) + ',' + str(gym[3]) + '>' await bot.say('There are ' + str(count) + ' gyms with the word(s) "' + str(raw_gym_name) + '" in it:\n' + str(gym_names)) database.commit() except: database.rollback() await bot.say( 'No gym with the word "' + str(raw_gym_name) + '" in it OR too many to list. Try narrowing down your search.')
async def scoreboard(ctx): if ctx and ctx.message.channel.id == str(bot_channel): try: scoreboard_query = "SELECT player_name, SUM(points) AS total_points FROM scoreboard GROUP BY player_name ORDER BY total_points DESC;" cursor.execute(scoreboard_query) scoreboard_data = cursor.fetchall() count = cursor.rowcount if (count == 0): raise Exception('The scoreboard is currently empty.') leaderboard = '' position = 1 for player in scoreboard_data: player_name, total_points = player leaderboard += str(position) + '. ' + str( player_name) + ': ' + str(total_points) + '\n' position += 1 if (leaderboard != ''): await bot.send_message(discord.Object(id=bot_channel), str(leaderboard)) database.commit() except Exception as e: message = e.args[0] await bot.send_message(discord.Object(id=bot_channel), message) except: database.rollback()
async def clearscoreboard(ctx): if (admin_channel == 'disabled'): await bot.say('The !clearscoreboard command is disabled') pass else: if ctx and ctx.message.channel.id == str(admin_channel): try: clear_scoreboard_query = "DELETE FROM scoreboard;" cursor.execute(clear_scoreboard_query) await bot.say('The scoreboard has been cleared!') database.commit() except: database.rollback()
async def spawn(ctx, arg, arg2, arg3, arg4=None): if ctx and ctx.message.channel.id == str(bot_channel) and str( arg).lower() in pokemon: pokemon_id = find_pokemon_id(str(arg).title()) time = get_time(15) desc = str(arg4) try: cursor.execute( "INSERT INTO sightings(" "id, pokemon_id, spawn_id, expire_timestamp, encounter_id, lat, lon, " "atk_iv, def_iv, sta_iv, move_1, move_2, gender, " "form, cp, level, updated, weather_boosted_condition, weather_cell_id, weight) " "VALUES (null, %s, null, %s, null, %s , %s" ", null, null, null, null, null, null," " null, null, null, null, null, null, null);", (str(pokemon_id), str(time), str(arg2), str(arg3))) database.commit() await bot.say( 'Successfully added your spawn to the live map.\n' '*Pokemon timers are automatically given 15 minutes since the timer is unknown.*' ) spawn_embed = discord.Embed( title='Click for directions!', url=("https://www.google.com/maps/?q=" + str(arg2) + "," + str(arg3)), description=('A wild ' + str(arg).title() + ' is available!\n\n' '**Time Remaining:** ~15 minutes.\n' '**Description:** ' + str(desc).title() + '\n' '**Spotted by:** ' + str(ctx.message.author.name) + '!'), color=3447003) spawn_embed.set_image( url="http://www.pokestadium.com/sprites/xy/" + str(arg).lower() + ".gif") await bot.send_message(discord.Object(id=spawn_channel), embed=spawn_embed) await bot.send_message( discord.Object(id=log_channel), str(ctx.message.author.name) + ' said there was a wild ' + str(arg) + ' at these coordinates: ' + str(arg2) + ', ' + str(arg3)) and print( str(ctx.message.author.name) + ' said there was a wild ' + str(arg) + ' at these coordinates: ' + str(arg2) + ', ' + str(arg3)) except: tb = traceback.print_exc(file=sys.stdout) print(tb) await bot.say( 'Unsuccessful in database query, your reported spawn was not added to the live map.' )
async def raid(ctx, raid_gym_name, raid_pokemon_name, raid_level, raid_time_remaining): if ctx and ctx.message.channel.id == str(bot_channel) and str(raid_pokemon_name).lower() in pokemon or str(raid_pokemon_name).lower() == "egg": """example: ^raid "Canandagua National Bank Clock Tower" Lugia 5 45""" time = datetime.datetime.utcnow() + timedelta() if raid_pokemon_name == "egg": pokemon_id = "NULL" pokecp = "NULL" start = datetime.datetime.utcnow() + timedelta(minutes=int(raid_time_remaining)) end = start + timedelta(minutes=int(60)) spawn = start - timedelta(minutes=int(60)) else: pokemon_id = find_pokemon_id(str(raid_pokemon_name).capitalize()) pokecp = find_pokecp(str(raid_pokemon_name).capitalize()) end = datetime.datetime.utcnow() + timedelta(minutes=int(raid_time_remaining)) start = end - timedelta(minutes=int(60)) spawn = start - timedelta(minutes=int(60)) try: cursor.execute("SELECT gym_id FROM gymdetails WHERE name LIKE '" + str(raid_gym_name) + "%';") gym_id = str(cursor.fetchall()) gym_id = gym_id.split(',') gym_id = gym_id[0].split('((') cursor.execute("REPLACE INTO raid(" "gym_id, level, spawn, start, " "end, pokemon_id, cp, move_1, " "move_2, last_scanned)" " VALUES ("+str('{}').format(gym_id[1])+", "+str(raid_level)+", "+str("'{}'").format(spawn)+", "+str("'{}'").format(start)+", "+str("'{}'").format(end)+", "+str(pokemon_id)+", "+str(pokecp)+", NULL, NULL, "+str("'{}'").format(time)+");") cursor.execute("UPDATE gym SET last_modified = '"+str(time)+"', last_scanned = '"+str(time)+"' WHERE gym_id = "+str(gym_id[1])+";") database.ping(True) database.commit() await bot.say('Successfully added your raid to the live map.') await bot.send_message(discord.Object(id=log_channel), str(ctx.message.author.name) + ' said there was a ' + str(raid_pokemon_name) + ' raid going on at ' + str(raid_gym_name)) and print(str(ctx.message.author.name) + ' said there was a ' + str(raid_pokemon_name) + ' raid going on at ' + str(raid_gym_name)) except: database.rollback() await bot.say('Unsuccesful in database query, your raid was not added to the live map.') await bot.say("Could not find `{}` in my database. Please check your gym name. \nuse `^gym gym-name` to try and look it up".format(raid_gym_name)) # Uncomment for debug messages #await bot.say("VALUES ("+str('{}').format(gym_id[1])+", "+str(raid_level)+", "+str("'{}'").format(time)+", "+str("'{}'").format(time)+", "+str("'{}'").format(now)+", "+str(pokemon_id)+", "+str(pokecp)+", 1, 1, "+str("'{}'").format(time)+");") #await bot.say("UPDATE gym SET last_modified = '"+str(time)+"', last_scanned = '"+str(time)+"' WHERE gym_id = "+str(gym_id[1])+";") tb = traceback.print_exc(file=sys.stdout) print(tb)
async def handle_missing_arg(ctx, error): try: cursor.execute("SELECT id, name, lat, lon FROM forts;") data = cursor.fetchall() count = cursor.rowcount gym_names = '' for gym in data: gym_names += str(gym[0]) + ': ' + gym[1] + ' (' + str( gym[2]) + ', ' + str(gym[3]) + ')\n' database.commit() await bot.say('There are ' + str(count) + ' gyms in the region:\n' + str(gym_names)) except: database.rollback() await bot.say( 'No gyms found OR too many to list. Try narrowing down your search.' )
def add_quest(pokestop, pokemon): pokemon_id = get_pokemon_id(pokemon) cursor.execute("select id from pokestops where name like '%" + str(pokestop) + "%'") res = cursor.fetchall() pokestop_id = res[0][0] date = get_date() query = ("insert into quests (" "id, fort_id, pokemon_id, date)" " values " "(null, " + str(pokestop_id) + ", " + str(pokemon_id) + ", " + str(date) + ");") logger.debug("Executing query in add_quest \n {}".format(query)) cursor.execute(query) database.commit()
async def deduct_it(ctx, raid_id): try: query_scoreboard_for_raid = "SELECT id, player_name FROM scoreboard WHERE raid_id='" + str( raid_id) + "' ORDER BY id DESC LIMIT 1;" cursor.execute(query_scoreboard_for_raid) raid_score_data = cursor.fetchall() raid_score_quantity = cursor.rowcount id, player_name_to_deduct = raid_score_data[0] if (raid_score_quantity > 0): # Delete only the last raid that was scored delete_raid_from_scoreboard_query = "DELETE FROM scoreboard WHERE raid_id='" + str( raid_id) + "' ORDER BY id DESC LIMIT 1;" cursor.execute(delete_raid_from_scoreboard_query) delete_count = cursor.rowcount database.commit() total_score_query = "SELECT SUM(points) AS total_points FROM scoreboard WHERE player_name='" + str( player_name_to_deduct) + "';" cursor.execute(total_score_query) player_score = cursor.fetchall() player_total_score = player_score[0][0] notify_of_deduction = "Raid was deleted. " + str( delete_count) + " points were deducted from " + str( player_name_to_deduct) + ".\n" + str( player_name_to_deduct) + " now has " + str( player_total_score) + " points." print(notify_of_deduction) await bot.send_message(discord.Object(id=bot_channel), "`" + notify_of_deduction + "`") else: raise Exception( 'Raid was deleted but was never scored so no points were deducted.' ) database.commit() except Exception as e: message = e.args[0] await bot.send_message(discord.Object(id=bot_channel), message) print(message) except: database.rollback()
async def spawn(ctx, arg, arg2, arg3): if ctx and ctx.message.channel.id == str(bot_channel) and arg in pokemon: pokemon_id = find_pokemon_id(str(arg).capitalize()) time = get_time(15) try: cursor.execute("INSERT INTO sightings(" "id, pokemon_id, spawn_id, expire_timestamp, encounter_id, lat, lon, " "atk_iv, def_iv, sta_iv, move_1, move_2, gender, " "form, cp, level, updated, weather_boosted_condition, weather_cell_id, weight) " "VALUES (null, " + str(pokemon_id) +", null," + str(time) + ", null," + str(arg2) + ", " + str(arg3) + ", null, null, null, null, null, null," " null, null, null, null, null, null, null);") database.commit() await bot.say('Successfully added your spawn to the live map.\n' '*Pokemon timers are automatically given 15 minutes since the timer is unknown.*') await bot.send_message(discord.Object(id=log_channel), str(ctx.message.author.name) + ' said there was a wild ' + str(arg) + ' at these coordinates: ' + str(arg2) + ', ' + str(arg3)) and print(str(ctx.message.author.name) + ' said there was a wild ' + str(arg) + ' at these coordinates: ' + str(arg2) + ', ' + str(arg3)) except: await bot.say('Unsuccessful in database query, your reported spawn was not added to the live map.')
def add_raid(boss, gym, end): pokemon_id = get_pokemon_id(boss) level = RAID[pokemon_id] if level is None: logger.error("No raid level found") cursor.execute("select id from forts where name like '%" + str(gym) + "%'") res = cursor.fetchall() gym_id = res[0][0] remaining_minute = int(end.split(':')[1]) time = get_end_time(remaining_minute) query = ("insert into raids (" "id, external_id, fort_id, level, pokemon_id, " "move_1, move_2, time_spawn, time_battle, time_end)" " values " "(null, null, " + str(gym_id) + ", " + str(level) + ", " + str(pokemon_id) + ", null, null, null, null, " + str(time) + ");") logger.debug("Executing query in add_raid \n {}".format(query)) cursor.execute(query) database.commit()
async def updategymname(ctx, fort_id, new_gym_name): if (admin_channel == 'disabled'): await bot.say('The !updategymname command is disabled') pass else: database.ping(True) if ctx and ctx.message.channel.id == str(admin_channel): try: cursor.execute("SELECT id, name FROM forts WHERE id='" + str(fort_id) + "';") gym_data = cursor.fetchall() gym_count = cursor.rowcount if (gym_count == 1): fort_id, gym_name = gym_data[0] cursor.execute("UPDATE forts SET name='" + str(new_gym_name) + "' WHERE id='" + str(fort_id) + "';") cursor.execute("SELECT name FROM forts WHERE id='" + str(fort_id) + "';") updated_gym_data = cursor.fetchall() updated_gym_name = updated_gym_data[0][0] await bot.say('Changed the name of:\n__' + str(fort_id) + ': ' + str(gym_name) + '__\nto:\n**' + str(fort_id) + ': ' + str(updated_gym_name) + '**') else: await bot.say( 'There are multiple gyms with gym_id: ' + str(fort_id) + '. Delete all of the duplicate gym_ids before proceeding.' ) database.commit() except: database.rollback()
async def raid(ctx, raw_pokemon_name, raw_time_remaining, *, raw_gym_name): if ctx and ctx.message.channel.id == str(bot_channel): pokemon_name = str(raw_pokemon_name).capitalize() pokemon_id = find_pokemon_id(pokemon_name) remaining_time = get_time(int(raw_time_remaining)) current_time = datetime.datetime.utcnow() current_hour = time.strftime( '%H%M', time.localtime(calendar.timegm(current_time.timetuple()))) gym_team_id = '0' # raw_raid_level = 5 database.ping(True) if (int(pokemon_id) == int(legendary_id)) or (pokemon_name == 'Egg'): raw_raid_level = '5' else: raw_raid_level = '4' raid_level = str(raw_raid_level) try: if ((int(raw_time_remaining) < 1) or (int(raw_time_remaining) >= 60)): raise Exception( 'Invalid time entered. Enter value between 1-60.') if (curfew == 'true'): if ((int(current_hour) >= 1930) or (int(current_hour) <= 500)): raise Exception( 'Raid report is outside of the valid raid times. Raids can be reported between 5am - 7:30pm daily.' ) if raw_gym_name.isnumeric(): cursor.execute( "SELECT id, name, lat, lon FROM forts WHERE id LIKE '" + str(raw_gym_name) + "';") else: cursor.execute( "SELECT id, name, lat, lon FROM forts WHERE name LIKE '%" + str(raw_gym_name) + "%';") gym_data = cursor.fetchall() count = cursor.rowcount raid_count = 0 gym_names = '' for gym in gym_data: gym_names += str(gym[0]) + ': ' + gym[1] + ' (' + str( gym[2]) + ', ' + str(gym[3]) + ')\n' # Single gym_id is returned so check if a raid exists for it if (count == 1): gym_id = gym_data[0][0] gym_name = gym_data[0][1] cursor.execute( "SELECT id, fort_id, time_end FROM raids WHERE fort_id='" + str(gym_id) + "' AND time_end>'" + str(calendar.timegm(current_time.timetuple())) + "';") raid_data = cursor.fetchall() raid_count = cursor.rowcount if (raid_count): raid_id = raid_data[0][0] raid_fort_id = raid_data[0][1] raid_time_end = raid_data[0][2] elif (count > 1): raise Exception('There are multiple gyms with the word "' + str(raw_gym_name) + '" in it:\n' + str(gym_names) + '\nBe a little more specific.') elif (count == 0): raise Exception( 'No gym with the word "' + str(raw_gym_name) + '" in it. Use the !list command to list gyms available in the region.\n' ) else: raise Exception( 'Error. !raid "*gym_name*" *pokemon_name* *minutes_left*\n' ) if (pokemon_name == "Egg"): est_end_time = remaining_time + 2700 if (raid_count): cursor.execute("UPDATE raids SET level='" + str(raw_raid_level) + "', time_battle='" + str(remaining_time) + "', time_end='" + str(est_end_time) + "' WHERE id='" + str(raid_id) + "';") await bot.say( 'Updated **Level ' + str(raw_raid_level) + ' ' + str(pokemon_name) + '**' + '\nGym: **' + str(gym_id) + ': ' + str(gym_name) + ' Gym' + '**' + '\nHatches: **' + str( time.strftime('%I:%M %p', time.localtime(remaining_time))) + '**' + '\nRaid Ends: **' + str( time.strftime('%I:%M %p', time.localtime(est_end_time))) + '**') else: # Setup task to automatically hatch Legendary egg if (raw_raid_level == '5'): bot.loop.create_task( incubate(ctx, gym_id, remaining_time)) cursor.execute("INSERT INTO raids(" "id, external_id, fort_id , level, " "pokemon_id, move_1, move_2, time_spawn, " "time_battle, time_end, cp, reported_by)" "VALUES " "(null, null, " + str(gym_id) + ", " + str(raw_raid_level) + ", " + str(pokemon_id) + ", null, null, " "null, " + str(remaining_time) + ", " + str(est_end_time) + ", null, '" + str(ctx.message.author.name) + "');") await bot.say( 'Added ' + str(pokemon_name) + '\nGym: **' + str(gym_name) + '**' + '\nHatches: **' + str( time.strftime('%I:%M %p', time.localtime(remaining_time))) + '**' + '\nRaid Ends: **' + str( time.strftime('%I:%M %p', time.localtime(est_end_time))) + '**' + '\nTime Left Until Hatch: **' + str(raw_time_remaining) + ' minutes**') raid_embed = discord.Embed( title='Hatch at: ' + str( time.strftime('%I:%M %p', time.localtime(remaining_time))), description='Gym: **' + str(gym_name) + '**' '\nRaid Ends: **' + str( time.strftime('%I:%M %p', time.localtime(est_end_time))) + '**' + '\nReported by: __' + str(ctx.message.author.name) + '__' + '\n\nhttps://www.google.com/maps?q=loc:' + str(gym_data[0][2]) + ',' + str(gym_data[0][3]), color=get_team_color(gym_team_id)) thumbnail_image_url = get_egg_url(raw_raid_level) raid_embed.set_thumbnail(url=thumbnail_image_url) await bot.send_message(discord.Object(id=log_channel2), embed=raid_embed) print( str(ctx.message.author.name) + ' reported a ' + str(pokemon_name) + ' at ' + str(gym_id) + ': ' + str(gym_name) + ' with ' + str(raw_time_remaining) + ' minutes left.') else: # Update Egg to a hatched Raid Boss if (raid_count): cursor.execute( "UPDATE raids SET pokemon_id='" + str(pokemon_id) + "', level='" + str(raw_raid_level) + "', time_battle='" + str(calendar.timegm(current_time.timetuple())) + "', time_end='" + str(remaining_time) + "' WHERE id='" + str(raid_id) + "';") await bot.say( 'Updated Egg to ' + str(pokemon_name) + ' Raid' + '\nGym: **' + str(gym_id) + ': ' + str(gym_name) + '**' + '\nRaid Ends: **' + str( time.strftime('%I:%M %p', time.localtime(remaining_time))) + '**') raid_embed = discord.Embed( title=str(pokemon_name) + ' Raid', description='Gym: **' + str(gym_name) + '**' + '\nRaid Ends: **' + str( time.strftime('%I:%M %p', time.localtime(remaining_time))) + '**' + '\nReported by: __' + str(ctx.message.author.name) + '__' + '\n\nhttps://www.google.com/maps?q=loc:' + str(gym_data[0][2]) + ',' + str(gym_data[0][3]), color=get_team_color(gym_team_id)) thumbnail_image_url = 'https://bitbucket.org/anzmap/sprites/raw/HEAD/' + str( pokemon_id) + '.png' raid_embed.set_thumbnail(url=thumbnail_image_url) await bot.send_message(discord.Object(id=log_channel), embed=raid_embed) print( str(ctx.message.author.name) + ' updated ' + str(raw_raid_level) + ' Egg to ' + str(pokemon_name) + ' Raid at ' + str(gym_name) + ' with ' + str(raw_time_remaining) + ' minutes left.') else: cursor.execute( "INSERT INTO raids(" "id, external_id, fort_id , level, " "pokemon_id, move_1, move_2, time_spawn, " "time_battle, time_end, cp, reported_by)" "VALUES " "(null, null, " + str(gym_id) + ", " + str(raw_raid_level) + ", " + str(pokemon_id) + ", null, null, " "null, " + str(calendar.timegm(current_time.timetuple())) + ", " + str(remaining_time) + ", null, '" + str(ctx.message.author.name) + "');") await bot.say( 'Added ' + str(pokemon_name) + ' Raid' + '\nGym: **' + str(gym_id) + ': ' + str(gym_name) + '**' + '\nRaid Ends: **' + str( time.strftime('%I:%M %p', time.localtime(remaining_time))) + '**' + '\nTime Left: **' + str(raw_time_remaining) + ' minutes**') raid_embed = discord.Embed( title=str(pokemon_name) + ' Raid', description='Gym: **' + str(gym_name) + '**' + '\nRaid Ends: **' + str( time.strftime('%I:%M %p', time.localtime(remaining_time))) + '**' + '\nReported by: __' + str(ctx.message.author.name) + '__' + '\n\nhttps://www.google.com/maps?q=loc:' + str(gym_data[0][2]) + ',' + str(gym_data[0][3]), color=get_team_color(gym_team_id)) thumbnail_image_url = 'https://bitbucket.org/anzmap/sprites/raw/HEAD/' + str( pokemon_id) + '.png' raid_embed.set_thumbnail(url=thumbnail_image_url) await bot.send_message(discord.Object(id=log_channel), embed=raid_embed) print( str(ctx.message.author.name) + ' reported a ' + str(pokemon_name) + ' raid at ' + str(gym_name) + ' with ' + str(raw_time_remaining) + ' minutes left.') # Check if fort_id exists in fort_sightings. If so update the entry, otherwise enter as a new entry. cursor.execute( "SELECT id, fort_id, team FROM fort_sightings WHERE fort_id='" + str(gym_id) + "';") fs_count = cursor.rowcount if (fs_count): cursor.execute("UPDATE fort_sightings SET team='" + str(gym_team_id) + "' WHERE fort_id='" + str(gym_id) + "';") else: cursor.execute( "INSERT INTO fort_sightings(fort_id, team, last_modified) VALUES (" + str(gym_id) + ", " + str(gym_team_id) + ", " + str(calendar.timegm(current_time.timetuple())) + ");") database.commit() except Exception as e: message = e.args[0] await bot.say(message) print(message) except: database.rollback()
async def activeraids(ctx): if ctx and ctx.message.channel.id == str(bot_channel): database.ping(True) current_time = datetime.datetime.utcnow() try: cursor.execute( "SELECT f.id, f.name, r.level, r.pokemon_id, r.time_battle, r.time_end FROM forts f JOIN raids r ON f.id=r.fort_id WHERE r.time_end>'" + str(calendar.timegm(current_time.timetuple())) + "' ORDER BY r.level DESC, r.time_end;") raid_data = cursor.fetchall() raid_count = cursor.rowcount await bot.say('There are currently ' + str(raid_count) + ' active raids.') active_raids_l5 = '' active_raids_l4 = '' active_raids_l3 = '' active_raids_l2 = '' active_raids_l1 = '' for raid in raid_data: fort_id, gym_name, raid_level, raid_pokemon_id, raid_time_battle, raid_time_end = raid if (raid_pokemon_id == 0): raid_pokemon_name = 'Egg - Legendary' else: raid_pokemon_name = pokejson[str(raid_pokemon_id)] if (raid_level == 5): active_raids_l5 += str( time.strftime('%I:%M %p', time.localtime(raid_time_end)) ) + ' : ' + str(raid_pokemon_name) + ' : ' + str( gym_name) + ' Gym (' + str(fort_id) + ')\n' elif (raid_level == 4): active_raids_l4 += str( time.strftime('%I:%M %p', time.localtime(raid_time_end)) ) + ' : ' + str(raid_pokemon_name) + ' : ' + str( gym_name) + ' Gym (' + str(fort_id) + ')\n' elif (raid_level == 3): active_raids_l3 += str( time.strftime('%I:%M %p', time.localtime(raid_time_end)) ) + ' : ' + str(raid_pokemon_name) + ' : ' + str( gym_name) + ' Gym (' + str(fort_id) + ')\n' elif (raid_level == 2): active_raids_l2 += str( time.strftime('%I:%M %p', time.localtime(raid_time_end)) ) + ' : ' + str(raid_pokemon_name) + ' : ' + str( gym_name) + ' Gym (' + str(fort_id) + ')\n' else: active_raids_l1 += str( time.strftime('%I:%M %p', time.localtime(raid_time_end)) ) + ' : ' + str(raid_pokemon_name) + ' : ' + str( gym_name) + ' Gym (' + str(fort_id) + ')\n' raid_report = '' if (active_raids_l5 != ''): raid_report += '**Legendary**\n' + active_raids_l5 if (active_raids_l4 != ''): raid_report += '\n**Other**\n' + active_raids_l4 if (active_raids_l3 != ''): raid_report += '\n**LEVEL 3**\n' + active_raids_l3 if (active_raids_l2 != ''): raid_report += '\n**LEVEL 2**\n' + active_raids_l2 if (active_raids_l1 != ''): raid_report += '\n**LEVEL 1**\n' + active_raids_l1 if (raid_report != ''): await bot.say('**Active Raids**\n' + str(raid_report)) database.commit() except: database.rollback() await bot.say('There are no active raids.')
async def deleteraid(ctx, fort_id): if ctx and ctx.message.channel.id == str(bot_channel): try: database.ping(True) current_time = datetime.datetime.utcnow() valid_user_query = "SELECT fort_id FROM raids WHERE fort_id='" + str( fort_id) + "' AND time_end>'" + str( calendar.timegm(current_time.timetuple()) ) + "' AND reported_by='" + str(ctx.message.author.name) + "';" print(str(valid_user_query) + " : ") cursor.execute(valid_user_query) valid_user_count = cursor.rowcount print("count - " + str(valid_user_count) + " : ") # Check if command is coming from original raid reporter or an admin if ((valid_user_count == 0) and (admin_role_id not in [role.id for role in ctx.message.author.roles])): raise Exception( 'Raid can only be deleted by original reporter or an Admin.' ) if fort_id.isnumeric(): print("fort id" + str(fort_id) + " : ") cursor.execute( "SELECT id, name, lat, lon FROM forts WHERE id='" + str(fort_id) + "';") gym_data = cursor.fetchall() count = cursor.rowcount fort_id = gym_data[0][0] gym_name = gym_data[0][1] gym_lat = gym_data[0][2] gym_lon = gym_data[0][3] # Gym id is valid and returned 1 result if (count == 1): print(str(fort_id) + ":" + str(gym_name)) cursor.execute( "SELECT id, fort_id, level, pokemon_id, time_battle, time_end FROM raids WHERE fort_id='" + str(fort_id) + "' AND time_end>'" + str(calendar.timegm(current_time.timetuple())) + "';") raid_data = cursor.fetchall() raid_count = cursor.rowcount raid_id, raid_fort_id, raid_level, raid_pokemon_id, raid_time_battle, raid_time_end = raid_data[ 0] # print("raid data " + raid_pokemon_id) if (raid_pokemon_id == 0): raid_pokemon_name = 'Egg (Umkonwn)' thumbnail_image_url = get_egg_url(raid_level) else: raid_pokemon_name = pokejson[str(raid_pokemon_id)] thumbnail_image_url = 'https://bitbucket.org/anzmap/sprites/raw/HEAD/' + str( raid_pokemon_id) + '.png' await bot.say( '**Deleted Raid**' + '\nGym: **' + str(fort_id) + ': ' + str(gym_name) + '**' + '\nPokemon: ** ' + str(raid_pokemon_name).capitalize() + '**' + '\nStart\Hatch Time: **' + str( time.strftime('%I:%M %p', time.localtime(raid_time_battle))) + '**' + '\nEnd Time: **' + str( time.strftime('%I:%M %p', time.localtime(raid_time_end))) + '**') delete_raid_query = "DELETE FROM raids WHERE fort_id='" + str( fort_id) + "' AND time_end>'" + str( calendar.timegm(current_time.timetuple())) + "';" cursor.execute(delete_raid_query) gym_team_id = 0 raid_embed = discord.Embed( title='~~' + str(raid_pokemon_name).capitalize() + '~~ **RAID DELETED**', description='Gym: ~~' + str(gym_name) + ' Gym~~' + '\nRaid Ends: ~~' + str( time.strftime('%I:%M %p', time.localtime(raid_time_end))) + '~~' + '\nDeleted by: __' + str(ctx.message.author.name) + '__', color=get_team_color(gym_team_id)) raid_embed.set_thumbnail(url=thumbnail_image_url) await bot.send_message(discord.Object(id=log_channel), embed=raid_embed) print( str(ctx.message.author.name) + ' deleted raid at ' + str(fort_id) + ': ' + str(gym_name) + '.') else: raise Exception('Gym ID provided is not valid.') else: raise Exception( 'Enter the numeric ID of the gym where the raid is located.' ) database.commit() except Exception as e: message = e.args[0] await bot.send_message(discord.Object(id=bot_channel), message) except: database.rollback() await bot.say('Raid at **' + str(fort_id) + ': ' + str(gym_name) + '** does not exist.')
#TODO:uncomment below cursor.execute(query, values) #execute query quantity number of times try: quantity = int(float(quantity)) while (quantity > 1): # TODO:uncomment below cursor.execute(query, values) quantity = quantity - 1 except ValueError: print " ValueError for quantity while attempting multiple insert" quantityTypeFieldErrorList.append(rowCount) database.commit() print " data commited" #empty array for new row rowList = [] #Stops the script every 'breakpoint' number of rows if (rowCount % breakpoint == 0): input = raw_input("Press enter to continue ") if (not emptyStringCheck(input)): break #Summary print "------------------------------------------------------------------------------------------------" cursor.close()
async def raid( ctx, arg, arg2, arg3, arg4 ): #arg = gym name, arg2 = pokemon name, arg3 = level, arg4 = time remaining if ctx and ctx.message.channel.id == str(bot_channel) and str( arg2).lower() in pokemon: """example: ^raid "Canandagua National Bank Clock Tower" Lugia 5 45""" pokemon_id = find_pokemon_id(str(arg2).capitalize()) pokecp = find_pokecp(str(arg2).capitalize()) now = datetime.datetime.utcnow() + timedelta(minutes=int(arg4)) time = datetime.datetime.utcnow() + timedelta() try: cursor.execute("SELECT gym_id FROM gymdetails WHERE name LIKE '" + str(arg) + "%';") gym_id = str(cursor.fetchall()) gym_id = gym_id.split(',') gym_id = gym_id[0].split('((') cursor.execute("REPLACE INTO raid(" "gym_id, level, spawn, start, " "end, pokemon_id, cp, move_1, " "move_2, last_scanned)" " VALUES (" + str('{}').format(gym_id[1]) + ", " + str(arg3) + ", " + str("'{}'").format(time) + ", " + str("'{}'").format(time) + ", " + str("'{}'").format(now) + ", " + str(pokemon_id) + ", " + str(pokecp) + ", 1, 1, " + str("'{}'").format(time) + ");") #"VALUES (%s, %s, "+str("'{}'").format(time)+", "+str("'{}'").format(time)+", "+str("'{}'").format(now)+", %s, %s, 1, 1, "+str("'{}'").format(time)+");", (str(gym_id[1]), str(pokemon_id), str(arg3), str(arg5))) cursor.execute("UPDATE gym SET last_modified = '" + str(time) + "', last_scanned = '" + str(time) + "' WHERE gym_id = " + str(gym_id[1]) + ";") database.ping(True) database.commit() await bot.say('Successfully added your raid to the live map.') await bot.send_message( discord.Object(id=log_channel), str(ctx.message.author.name) + ' said there was a ' + str(arg2) + ' raid going on at ' + str(arg)) and print( str(ctx.message.author.name) + ' said there was a ' + str(arg2) + ' raid going on at ' + str(arg)) #await bot.say("VALUES ("+str('{}').format(gym_id[1])+", "+str(arg3)+", "+str("'{}'").format(time)+", "+str("'{}'").format(time)+", "+str("'{}'").format(now)+", "+str(pokemon_id)+", "+str(pokecp)+", 1, 1, "+str("'{}'").format(time)+");") #await bot.say("UPDATE gym SET last_modified = '"+str(time)+"', last_scanned = '"+str(time)+"' WHERE gym_id = "+str(gym_id[1])+";") except: #database.connect() database.rollback() await bot.say( 'Unsuccesful in database query, your raid was not added to the live map.' ) await bot.say( "Could not find `{}` in my database. Please check your gym name. \nuse `^gym gym-name` to try and look it up" .format(arg)) await bot.say("VALUES (" + str('{}').format(gym_id[1]) + ", " + str(arg3) + ", " + str("'{}'").format(time) + ", " + str("'{}'").format(time) + ", " + str("'{}'").format(now) + ", " + str(pokemon_id) + ", " + str(pokecp) + ", 1, 1, " + str("'{}'").format(time) + ");") await bot.say("UPDATE gym SET last_modified = '" + str(time) + "', last_scanned = '" + str(time) + "' WHERE gym_id = " + str(gym_id[1]) + ";") tb = traceback.print_exc(file=sys.stdout) print(tb)
async def raid( ctx, arg, arg2, arg3, arg4 ): # arg = gym name, arg2 = pokemon name, arg3 = level, arg4 = time remaining if ctx and ctx.message.channel.id == str(bot_channel) and str( arg2).lower() in pokemon: pokemon_id = find_pokemon_id(str(arg2).capitalize()) time = get_time(int(arg4)) try: cursor.execute("SELECT url FROM forts WHERE name LIKE '" + str(arg) + "%';") image = str(cursor.fetchall()) image = image.split(',') image = image[0].split("'") cursor.execute("SELECT name FROM forts WHERE name LIKE '" + str(arg) + "%';") gym_title = str(cursor.fetchall()) if '"' in gym_title: gym_title = gym_title.split('"') elif "'" in gym_title: gym_title = gym_title.split("'") cursor.execute("SELECT lat FROM forts WHERE name LIKE '" + str(arg) + "%';") lat = str(cursor.fetchall()) lat = lat.split(',') lat = lat[0].split('(') cursor.execute("SELECT lon FROM forts WHERE name LIKE '" + str(arg) + "%';") lon = str(cursor.fetchall()) lon = lon.split(',') lon = lon[0].split('(') cursor.execute("SELECT id FROM forts WHERE name LIKE '" + str(arg) + "%';") gym_id = str(cursor.fetchall()) gym_id = gym_id.split(',') gym_id = gym_id[0].split('((') raid_embed = discord.Embed( title=(str(gym_title[1])), url=("https://www.google.com/maps/?q=" + str(lat[2]) + "," + str(lon[2])), description=str(arg2).capitalize() + " raid is available on the live map!\n" "**Level:** " + str(arg3) + "\n" "**L20 100%:** " + str(calculate_cp(pokemon_id, 20, 15, 15, 15)) + "\n" "**L25 100%:** " + str(calculate_cp(pokemon_id, 25, 15, 15, 15)) + "\n" "**Minutes Remaining:** " + str(arg4) + "\n" "**Live Map:** " + str(website), color=3447003) raid_embed.set_thumbnail(url=image[1]) raid_embed.set_image(url="http://www.pokestadium.com/sprites/xy/" + str(arg2).lower() + ".gif") cursor.execute( "INSERT INTO raids(" "id, external_id, fort_id , level, " "pokemon_id, move_1, move_2, time_spawn, " "time_battle, time_end, cp)" "VALUES " "(null, null, %s, " "%s, %s, null, null, " "null, null, %s, null);", (str(gym_id[1]), str(arg3), str(pokemon_id), str(time))) database.commit() await bot.say('Successfully added your raid to the live map.') await bot.send_message(discord.Object(id=raids_channel), embed=raid_embed) await bot.send_message( discord.Object(id=log_channel), str(ctx.message.author.name) + ' said there was a ' + str(arg2) + ' raid going on at ' + str(arg)) and print( str(ctx.message.author.name) + ' said there was a ' + str(arg2) + ' raid going on at ' + str(arg)) except: database.rollback() tb = traceback.print_exc(file=sys.stdout) print(tb) await bot.say( 'Unsuccessful in database query, your raid was not added to the live map.' )
async def score_it(ctx, gym_id, time_end_to_match, report_type): try: current_time = datetime.datetime.utcnow() score_eligibility_query = "SELECT s.id, s.raid_id, s.report_type FROM scoreboard s JOIN raids r ON s.raid_id=r.id WHERE r.fort_id='" + str( gym_id) + "' AND s.report_type IS NOT NULL AND s.time_end>'" + str( calendar.timegm(current_time.timetuple())) + "';" #print("SELECT s.id, s.raid_id, s.report_type FROM scoreboard s JOIN raids r ON s.raid_id=r.id WHERE r.fort_id='" + str(gym_id) + "' AND s.report_type IS NOT NULL AND s.time_end>'" + str(calendar.timegm(current_time.timetuple())) + "';") cursor.execute(score_eligibility_query) scoring_lines = cursor.fetchall() count = cursor.rowcount if (count): score_id, scored_raid_id, scored_report_type = scoring_lines[0] if (count == 0): raid_query = "SELECT id, fort_id, level, time_end FROM raids WHERE fort_id='" + str( gym_id) + "' AND time_end='" + str(time_end_to_match) + "';" cursor.execute(raid_query) raid_data = cursor.fetchall() raid_id, fort_id, raid_level, raid_time_end = raid_data[0] insert_added_egg_query = "INSERT INTO scoreboard(player_name, raid_id, raid_level, time_end, points, report_type) " + "VALUES ('" + str( ctx.message.author.name) + "','" + str(raid_id) + "','" + str( raid_level) + "','" + str(raid_time_end) + "','" + str( FULL_POINT) + "','" + str(ADDED_EGG) + "' );" cursor.execute(insert_added_egg_query) total_score_query = "SELECT SUM(points) AS total_points FROM scoreboard WHERE player_name='" + str( ctx.message.author.name) + "';" cursor.execute(total_score_query) player_score = cursor.fetchall() player_total_score = player_score[0][0] notify_of_total_score = str( ctx.message.author.name) + " has " + str( player_total_score) + " points." notify_of_score = str(ctx.message.author.name) + " scored " + str( FULL_POINT) + " point." print(notify_of_score) await bot.send_message( discord.Object(id=bot_channel), "`\n" + notify_of_score + "\n" + notify_of_total_score + "`") elif ((count == 1) and (scored_report_type == ADDED_EGG)): raid_query = "SELECT id, fort_id, level, time_end FROM raids WHERE fort_id='" + str( gym_id) + "' AND time_end='" + str(time_end_to_match) + "';" cursor.execute(raid_query) raid_data = cursor.fetchall() raid_id, fort_id, raid_level, raid_time_end = raid_data[0] insert_hatched_egg_query = "INSERT INTO scoreboard(player_name, raid_id, raid_level, time_end, points, report_type) " + "VALUES ('" + str( ctx.message.author.name) + "','" + str(raid_id) + "','" + str( raid_level) + "','" + str(raid_time_end) + "','" + str( FULL_POINT) + "','" + str(HATCHED_EGG) + "' );" cursor.execute(insert_hatched_egg_query) total_score_query = "SELECT SUM(points) AS total_points FROM scoreboard WHERE player_name='" + str( ctx.message.author.name) + "';" cursor.execute(total_score_query) player_score = cursor.fetchall() player_total_score = player_score[0][0] notify_of_total_score = str( ctx.message.author.name) + " has " + str( player_total_score) + " points." notify_of_score = str(ctx.message.author.name) + " scored " + str( FULL_POINT) + " point." print(notify_of_score) await bot.send_message( discord.Object(id=bot_channel), "`\n" + notify_of_score + "\n" + notify_of_total_score + "`") else: # User maxed out attempts to score for this raid notify_of_nonscore = str( ctx.message.author.name ) + " did not score points for this update." print(notify_of_nonscore) await bot.send_message(discord.Object(id=bot_channel), "`" + notify_of_nonscore + "`") database.commit() except: print('Error. Something went wrong in scoring.') database.rollback()