Example #1
0
    path = (
        r"C:\Users\aykorri\OneDrive - Cisco\Desktop\SE Hack\screenshot.png")
    #titles = pygetwindow.getAllTitles()

    #x1, y1, width, height = pygetwindow.getWindowGeometry('How to screenshot a specific window using Python')
    #x2 = x1 + width
    #y2 = y1 + height

    #pyautogui.screenshot(path)

    #im = Image.open(path)
    #im = im.crop((x1, y1, x2, y2))
    #im.save(path)
    #im.show(path)

    u = r"C:\Users\aykorri\OneDrive - Cisco\Desktop\SE Hack\screenshot.png"
    response.files = u
    return response


bot.set_greeting(botgreeting)

bot.add_command(
    "/capture dashboard",
    "Takes a screenshot from your Grafana dashboard to be returned",
    capturescreen)

if __name__ == "__main__":
    # Run Bot
    bot.run(host="0.0.0.0", port=5000)
Example #2
0
        user_email = msg[0]
        if user_email in self.approved_users:
            self.approved_users.remove(user_email)
            return "User {} removed from approved users list.".format(user_email)
        else:
            return "User not found in approved users list."
    else:
        return "No user provided."


# Create help message for current_time command
current_time_help = "Look up the current time for a given timezone. "
current_time_help += "_Example: **/time EST**_"

# Set the bot greeting.
bot.set_greeting(greeting)

# Add new commands to the bot.
bot.add_command("attachmentActions", "*", handle_cards)
bot.add_command("/showcard", "show an adaptive card", show_card)
bot.add_command("/dosomething", "help for do something", do_something)
bot.add_command(
    "/demo", "Sample that creates a Teams message to be returned.", ret_message
)
bot.add_command("/time", current_time_help, current_time)

# Add new admin commands to the bot.
bot.add_admin_command(
    "/approve_user", "Add user email address to bot approved users list", approve_user
)
bot.add_admin_command(
teams_token = os.getenv('TEAMS_TOKEN')
bot_url = os.getenv('BOT_URL')
bot_app_name = os.getenv('BOT_APP_NAME')

# Create a Bot Object
app = TeamsBot(
    bot_app_name,
    teams_bot_token=teams_token,
    teams_bot_url=bot_url,
    teams_bot_email=bot_email,
)

# Add new commands to SparkBot.

# Set the bot greeting.
app.set_greeting(greeting)

app.add_command("/time", "Get Time, Date, and Week information for a Timezone.\nExample: /time EST", current_time)

app.add_command("/greeting", "Bot Greeting", greeting)

app.add_command("/debug_data", "Debug Data. Examples of accessing Space specific data.", debug_data)

app.add_command("/need_comic", "Need some random comic relief", need_comic)

app.add_command("/aci_health", "Check Overall Health of the DevNet Always On APIC", aci_health)

app.add_command("/aci_faults", "List top 15 Faults on DevNet Always On APIC", aci_faults)

app.add_command("/l3_sum", "Show Routable Interfaces on device", l3_sum)