MCPcopy Create free account
hub / github.com/RocketGod-git/shodanbot / search

Function search

main.py:521–537  ·  view source on GitHub ↗
(interaction: discord.Interaction)

Source from the content-addressed store, hash-verified

519
520 @client.tree.command(name="shodan", description="Advanced and basic Shodan queries. Use `/help` for examples.")
521 async def search(interaction: discord.Interaction):
522 try:
523 # Log the user and guild information
524 user = interaction.user.name
525 guild_name = interaction.guild.name if interaction.guild else "Direct Message"
526 # logger.info(f"{user} initiated a Shodan search from {guild_name}")
527
528 modal = QueryModal(title="Shodan Search Query")
529 await interaction.response.send_modal(modal)
530
531 except discord.HTTPException as e:
532 logger.error(f"HTTP error while sending the modal to {user} in {guild_name}: {e}")
533 await handle_errors(interaction, e, "HTTP Error")
534
535 except Exception as e:
536 logger.error(f"Unexpected error while processing the search command for {user} in {guild_name}: {e}")
537 await handle_errors(interaction, e)
538
539 @client.tree.command(name="searchcity", description="Search Shodan by city.")
540 async def searchcity(interaction: discord.Interaction, city: str):

Callers

nothing calls this directly

Calls 2

QueryModalClass · 0.85
handle_errorsFunction · 0.85

Tested by

no test coverage detected