Skip to content

Commit

Permalink
Fix whois if to remove unneeded else, move WHOIS to stored procedure.
Browse files Browse the repository at this point in the history
  • Loading branch information
Rixxan committed Dec 8, 2021
1 parent 9bdd6e5 commit 878b0d0
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 22 deletions.
12 changes: 6 additions & 6 deletions data/facts/backup_facts.json
Expand Up @@ -3,7 +3,7 @@
"cbinfo-en": "DO NOT LOG IN and provide the following info if you know it:\u0002 (1/2) %n% CMDR Name, Current System, Hull %, O2 Time Left, Platform, and if you have any life support synthesis. (2/2)",
"cbmining-en": "You can find the location of objects using the radar module. Select the item you want on the left hand panel, then go towards it using your radar. (1/2) %n% Open your cargo scoop, and then go towards the item. Move your ship above the item slightly, then move forward with a speed of less then 40. (2/2)",
"clientinfo-en": "Greetings, CMDR. Please provide the following information: (1/2) %n% CMDR Name, Current System, Hull %, and Platform. If your canopy is breached,\u0002LOG OUT IMMEDIATELY. (2/2)\u0002",
"paperwork-en": "Primary Seal: Don't forget to do your paperwork! http://hullse.al/ppwk",
"paperwork-en": "Primary Seal: Don't forget to do your paperwork! https://hullse.al/ppwk",
"pcfr-en": "Please tap ESC to go to the PAUSE menu, click SOCIAL, enter the CMDR name in the box, and click ADD FRIEND on their name.",
"psfr-en": "Please tap your PlayStation button, then open the Friends screen from Functions, search for your Seal's name, and add them as your friend.",
"xbfr-en": "Please tap your XBOX button, then go to the Social tab and search for your Seal's name. Be sure to add the Seal(s) as your friend.",
Expand All @@ -13,22 +13,22 @@
"verify-en": "We just need to check some things. Please confirm for us:\u0002 (1/4) %n% Your Current Game Mode, CMDR name, and current system. (2/4) %n% <<ITALICS>>Please also provide a screenshot of your cockpit view, with system and date visible. We encourage programs like imgur or Discord for image hosting. (3/4)<<ITALICS>> %n% Seals, please hold position while we check. (4/4)",
"chatter-en": "{{- - - - - - - - - - - - - - - - %n% }}please keep chatter to #seal-bob. Thank you.",
"join-en": "Greetings, Welcome to the Hull Seals! Here's some info to get you started on joining us: https://hullse.al/How2Join",
"bacon-en": "The bacon is lit! -- https://youtu.be/Wd2qRSzCj84",
"bacon-en": "The bacon is lit! -- httpss://youtu.be/Wd2qRSzCj84",
"fuel-en": "For fuel emergencies, your best bet is the Fuel Rats: https://fuelrats.com/i-need-fuel",
"cmdlist-en": "Common HalpyBOT Commands: http://hullse.al/cmdlist",
"cmdlist-en": "Common HalpyBOT Commands: https://hullse.al/cmdlist",
"welcome-en": "Welcome to the Hull Seals! We've got your case details and we'll be with you shortly. %n% Just take a breath, stay calm, and follow all instructions given to you by Dispatchers. %n% If a blue oxygen timer comes up at any time, log out to the main menu and inform us immediately.",
"tos-en": "Our Terms of Service and Important Info: https://hullse.al/ImportantInfo",
"highg-en": "Remain landed until instructed by your dispatcher. When instructed, use your <<BOLD>>VERTICAL THRUSTERS ONLY<<BOLD>> to rise up to at least 6km above the surface. (1/2) %n% Keep your landing gear deployed until you are ready to jump to supercruise, and keep your ship aligned horizontally with the planet at all times. (2/2)",
"synth-en": "To synth a new life support refill, Go to the right-hand menu, and select to the 'Inventory' tab. (1/3) %n% Go down to 'Synthesis' (the second to last option), choose 'Life Support', and then select 'Resupply Life Support'. (2/3) %n% This requires you have 2 iron and 1 nickel in your materials reserve. (3/3)",
"help-en": "See https://hullse.al/cmdlist for common commands. %n% If you need technical help with the bot, please type /join #cybers and one of the Cyberseals will help you out there.",
"nickserv-en": "Switch to the HullSeals tab in the top left corner (Or your Status window) and identify with NickServ with the following command, but replace <password> with your website password: /msg NickServ IDENTIFY <password>",
"pcfr-nl": "Druk alstjeblieft op ESC om naar het PAUSE menu te gaan, klik op SOCIAL, voer de CMDR naam in in de searchbox, en klik bij hun naam op ADD FRIEND",
"pw-en": "Primary Seal: Don't forget to do your paperwork! http://hullse.al/ppwk",
"clear-en": "Primary Seal: Don't forget to do your paperwork! http://hullse.al/ppwk",
"pw-en": "Primary Seal: Don't forget to do your paperwork! https://hullse.al/ppwk",
"clear-en": "Primary Seal: Don't forget to do your paperwork! https://hullse.al/ppwk",
"wr-en": "Please add your Seal to your wing. Open your Comms Panel (top left option), and select the third tab. Then, select the Seal(s) you want, and select Invite to Wing.",
"bc-en": "To turn on your beacon, Go to the right-hand menu, and select to the 'Ship' tab. (1/2) %n% Under Functions, select 'Beacon', and then select 'Wing' or 'Team'. (2/2)",
"drillpw-en": "Primary Seal: Don't forget to do your paperwork! https://hullse.al/drillpw",
"ppwk-en": "Primary Seal: Don't forget to do your paperwork! http://hullse.al/ppwk",
"ppwk-en": "Primary Seal: Don't forget to do your paperwork! https://hullse.al/ppwk",
"kfbeacon-en": "To turn on your beacon, go to the Comms menu, and select the Social (3rd) tab. (1/2) %n% Select 'Options' and click on 'Enable Wing Beacon' (or 'Team Beacon'). (2/2)",
"srvbeacon-en": "To turn on your beacon, go to the Comms menu, and select the Social (3rd) tab. (1/2) %n% Select 'Options' and click on 'Enable Wing Beacon' (or 'Team Beacon'). (2/2)",
"rebootrepair-en": "Reboot/Repair is a way for your ship to cannibalize working modules in an effort to repair damaged modules. (1/4) %n% To initiate Reboot/Repair, please navigate to the right-hand menu, and select 'Ship'. (2/4) %n% Select 'Reboot/Repair', wait for the timer to complete, then select 'Confirm' (3/4) %n% Ship will power down and reboot all modules/systems until complete. (4/4)",
Expand Down
2 changes: 1 addition & 1 deletion src/commands/userinfo.py
Expand Up @@ -30,7 +30,7 @@ async def cmd_whois(ctx: Context, args: List[str]):
"""
if len(args) == 0:
return await ctx.reply("!whois [user]: Returns information about a given user.")
cmdr = ' '.join(args[0:]) # TODO replace by ctx method
cmdr = args[0]
if cmdr.lower() == "halpybot":
return await ctx.reply("That's me! CMDR HalpyBOT has a Seal ID of 0, registered 14.8 billion years ago, "
"is a DW2 Veteran and Founder Seal with registered CMDRs of Arf! Arf! Arf!, "
Expand Down
21 changes: 7 additions & 14 deletions src/packages/seals/userinfo.py
Expand Up @@ -15,26 +15,19 @@

from ..database import DatabaseConnection, NoDatabaseConnection


async def whois(subject):
# Set default values
uID, uCases, uName, uRegdate, uDW, uDW2 = None, None, None, None, None, None
get_query = (
f"SELECT seal_ID, COUNT(DISTINCT c.case_ID) AS cases, GROUP_CONCAT(DISTINCT CONCAT(ss.seal_name, ', ', "
f"pl.platform_name) SEPARATOR '; '), DATE(join_date), IF(seal_ID<382, TRUE, FALSE) AS DW2Seal "
" FROM records.cases AS c"
" INNER JOIN records.case_assigned AS ca ON ca.case_ID = c.case_ID"
" RIGHT JOIN sealsudb.staff as ss ON ss.seal_ID = ca.seal_kf_id"
" INNER JOIN lookups.platform_lu AS pl ON pl.platform_id = ss.platform"
" INNER JOIN pydle.view_joindate AS au ON au.id = ss.seal_ID"
" INNER JOIN pydle.view_irccore AS nc ON nc.id = ss.seal_ID"
" INNER JOIN pydle.view_ircnames AS na ON na.nc = nc.display"
" WHERE nick = %s;")
try:

with DatabaseConnection() as db:
cursor = db.cursor()
cursor.execute(get_query, (subject,))
for res in cursor.fetchall():
args = (subject, 0, 0, 0, 0, 0, 0)
cursor.callproc('spWhoIs', args)
for res in cursor.stored_results():
result = res.fetchall()
for res in result:
uID, uCases, uName, uRegdate, uDW = res
if uDW == 1:
uDW2 = ", is a DW2 Veteran and Founder Seal with registered CMDRs of"
Expand All @@ -44,7 +37,7 @@ async def whois(subject):
except NoDatabaseConnection:
return "Error searching user."

if uID == None:
if uID is None:
return "No registered user found by that name!"
else:
return f"CMDR {subject} has a Seal ID of {uID}, registered on {uRegdate}{uDW2} {uName}" \
Expand Down
4 changes: 3 additions & 1 deletion start.py
Expand Up @@ -58,6 +58,7 @@
root.addHandler(CLI_handler)
root.addHandler(file_handler)


def _start_bot():
"""Starts HalpyBOT with the specified config values."""
from src import commands # pylint disable=unused-import
Expand All @@ -81,10 +82,11 @@ def _start_bot():
tls=config.getboolean('IRC', 'useSsl'), tls_verify=False)
pool.handle_forever()


def _start_server():
server_loop = asyncio.new_event_loop()
asyncio.set_event_loop(server_loop)
loop = asyncio.get_event_loop()
asyncio.get_event_loop()

web.run_app(app=APIConnector, port=int(config['API Connector']['port']))

Expand Down

0 comments on commit 878b0d0

Please sign in to comment.