#Screenshot command

1 messages · Page 1 of 1 (latest)

serene tendon
#

Hello, so I was making a remote controller for a game (allowed) and I tried making a screenshot command, the user that wants to get the remote controller, creates a bot puts the token in an input field and then the bot starts running. I tried creating it and there's no error, just that the slash command isn't showing up.

minor jettyBOT
#

Hey! Once your issue is solved, press the button below to close this thread!

serene tendon
#

bot code:

#
## IMPORTS ##
from interactions import slash_command, Client
import interactions
import pyautogui
import token_manager

## VARIABLES ##
bot = interactions.Client()

@slash_command(
    name="screenshot",
    description="Make a screenshot of the screen"
)
async def take_screenshot(ctx):
    try:
        screenshot = pyautogui.screenshot()
        screenshot.save("screenshot.png")
        await ctx.send(embed={
            "title": "Screenshot Taken",
            "description": "Here's the screenshot:",
            "image": {"url": "attachment://screenshot.png"},
            "color": 0x00ff00  # Green color
        }, file="screenshot.png")
    except Exception as e:
        await ctx.send(embed={
            "title": "Error",
            "description": f"An error occurred: {str(e)}",
            "color": 0xff0000  # Red color
        })

@slash_command(
    name="exit",
    description="Exit the macro"
)
async def exit_macro(ctx):
    try:
        pyautogui.press('f3')
        await ctx.send(embed={
            "title": "Macro Exited",
            "description": "The macro has been exited successfully.",
            "color": 0x0000ff  # Blue color
        })
    except Exception as e:
        await ctx.send(embed={
            "title": "Error",
            "description": f"An error occurred: {str(e)}",
            "color": 0xff0000  # Red color
        })

@slash_command(
    name="pause",
    description="Pause the macro"
)
async def```
#
pause_macro(ctx):
    try:
        pyautogui.press('f2')
        await ctx.send(embed={
            "title": "Macro Paused",
            "description": "The macro has been paused.",
            "color": 0xffff00  # Yellow color
        })
    except Exception as e:
        await ctx.send(embed={
            "title": "Error",
            "description": f"An error occurred: {str(e)}",
            "color": 0xff0000  # Red color
        })

@slash_command(
    name="start",
    description="Start the macro"
)
async def start_macro(ctx):
    try:
        pyautogui.press('f1')
        await ctx.send(embed={
            "title": "Macro Started",
            "description": "The macro has been started.",
            "color": 0xff00ff  # Purple color
        })
    except Exception as e:
        await ctx.send(embed={
            "title": "Error",
            "description": f"An error occurred: {str(e)}",
            "color": 0xff0000  # Red color
        })

@bot.event
async def on_ready():
    print(f'Logged in as {bot.user.name}')

    directory = "bot/token"
    token = token_manager.read_token(directory)
    if not token:
        token_manager.show_token_popup(directory)
        token = token_manager.read_token(directory)
    bot.start(token)```
#

-cut code into 2 messages because of limit-

#

<ping me>

pearl kettle
#

unless thats discord messing up the indentation

serene tendon
#

I'm not at home when I am imma check it out ty

serene tendon
#

It was that tysm