Beispiel #1
0
def update_set(webhook, set_info):

    hook = Webhook(webhook)
    embed = Embed(
        color=14177041,
        title="Release Date Update",
        description=set_info["name"],
        timestamp="now",
    )

    embed.add_field(name="Release Date",
                    value=set_info["release_date"],
                    inline=False)

    embed.add_field(name="Category", value=set_info["category"], inline=False)

    embed.add_field(name="View Full Calendar",
                    value="[Click here](https://tempest.cards/)",
                    inline=True)

    embed.set_author(
        name="Card Release Calendar",
        icon_url=
        "https://cdn.discordapp.com/attachments/161323390362320897/743688864694009856/Untitled-1.png"
    )

    embed.set_footer(
        text="Tempest Cards Release Calendar",
        icon_url=
        "https://cdn.discordapp.com/attachments/161323390362320897/743688864694009856/Untitled-1.png"
    )

    hook.send(embed=embed)
Beispiel #2
0
def discord_embed(severity, source, title, description=None, **fields):
    """Send an embedded message to discord.
    """
    global DISCORD_WARNING_SENT

    severity_icon, discord_url = severities[severity]

    if not discord_url or discord_url == 'none':
        if not DISCORD_WARNING_SENT:
            DISCORD_WARNING_SENT = True
            logging.warning(
                'DISCORD_WEBHOOK_URL not configured, will not send messages to discord.'
            )
        logging.info('Discord embed not sent: %s: %s: %s', title, description,
                     fields)
        return

    try:
        discord = Webhook(discord_url)
        title = severity_icon + ' ' + title
        embed = Embed(title=title,
                      description=description,
                      color=0xff0000,
                      timestamp='now')
        embed.set_author(source)
        for field, value in fields.items():
            embed.add_field(field, value)
        discord.send(embed=embed)
    except Exception as e:
        logging.error('Unhandled exception when sending discord embed:')
        logging.exception(e)
def send_webhook(title, inputsize, image, url, paymentype, checkout_time):
    try:
        hook = Webhook(url=webhook_url)
        embed = Embed(title='SACAI Checkout',
                      color=15957463,
                      url=url,
                      thumbnail_url=str(image))

        embed.add_field(name='Product', value=str(title))
        embed.add_field(name='Product Size', value=str(inputsize))
        embed.add_field(name='Payment Type', value=str(paymentype))
        embed.add_field(name='Checkout Speed',
                        value=str(checkout_time) + ' sec')
        embed.set_footer(
            text=
            f'BONZAY SACAI • {datetime.datetime.now().strftime("%Y-%m-%d %H:%M")}',
            icon_url=
            'https://cdn.discordapp.com/icons/594125608003305492/7f5110cf3bb22f6d622cd03ba1586f59.webp?size=512'
        )

        hook.send(embed=embed)
        print(gettime() + Fore.GREEN + Style.BRIGHT +
              ' [SUCCESS] -> Successfully sent success webhook!')
    except:
        print(gettime() + Fore.RED +
              ' [ERROR] -> Failed sending success webhook!')
Beispiel #4
0
def discord_webhook(product_item):
    hook = Webhook(url="")
    """
    Sends a Discord webhook notification to the specified webhook URL
    :param product_item: An array of the product's details
    :return: None
    """
    embed = Embed(color=int(16711816))
    if product_item == 'initial':
        embed.description = 'NBA Top Shot Monitor // INITIALISED // Twitter: @LNDNHYPE :smile:'
    else:
        embed.set_author('NBA Top Shot Monitor')
        embed.set_title(title=f'{product_item[1]}')  # Item Name
        embed.add_field(name='Price:', value=product_item[2], inline=True)
        embed.add_field(name='Stock Count:',
                        value=product_item[4],
                        inline=True)
        embed.add_field(name='Remaining:', value=product_item[3], inline=True)
        embed.add_field(name='Pre Order:', value=product_item[5], inline=False)
        #embed.set_thumbnail(product_item[4])

    embed.set_footer(
        text=
        f'Developer Twitter: @LNDNHYPE • {datetime.now().strftime("%Y-%m-%d %H:%M")}',
        icon_url='https://i.imgur.com/jjOXloc.png')

    try:
        hook.send(embed=embed)
    except requests.exceptions.HTTPError as err:
        print(err)
        logging.error(msg=err)
    else:
        print("Payload delivered successfully")
        logging.info("Payload delivered successfully")
    def post_changes(self):
        """ Posts the changes to the Discord server via a webhook. """
        # TODO: This brakes when user writes "'"
        regex = r"Change (?P<change_number>\d*) on (?P<date>\d{4}/\d{2}/\d{2}) (?P<time>\d{2}:\d{2}:\d{2}) by (?P<name>.*)@.* \'(?P<message>.*?)\'"
        substitution = "\g<message>- \g<name>/\g<change_number>"

        message = re.sub(regex,
                         substitution,
                         self.check_p4(),
                         flags=re.MULTILINE)

        output = self.check_p4()
        payload = self.check_for_changes(output)
        if payload != "":
            # Make webhook embed
            hook = Webhook(self.webhook_url)

            embed = Embed(description=message, color=49915, timestamp="now")
            # Post to channel
            hook.send(
                embed=embed,
                username="******",
                avatar_url="https://i.imgur.com/WseNTPC.jpg",
            )
        else:
            return
Beispiel #6
0
def webhook_spammer(webhook_url, message, delay):
    webhookurl = Webhook(webhook_url)

    while True:
        time.sleep(delay)
        webhookurl.send("Made By Aeron: " + message)
        return ("Sent.")
def nuker():
    start = input(">")
    hook = Webhook(start)
    hook.send(
        "This webhook has forcefully been deleted :gorilla: :middle_finger: :gorilla:"
    )
    x = requests.delete(start)
async def on_ready():
    # console related
    # ================================================

    subprocess.call('cls', shell=True)
    print('\033[92m' + (str(datetime.datetime.now())[:-7]) + prefix + 'Logged in as')
    print((str(datetime.datetime.now())[:-7]) + prefix + client.user.name)
    print((str(datetime.datetime.now())[:-7]) + prefix + str(client.user.id))
    print((str(datetime.datetime.now())[:-7]) + prefix + '------')

    # discord related
    # ================================================

    game1 = discord.Game(name='>umfrage')
    await client.change_presence(activity=game1)

    # ================================================
    hook = Webhook(webhooklogs)

    # ================================================

    embed = Embed(
        title='umfrageBot - Status',
        description='I am ready again!',
        thumbnail_url='https://i0.wp.com/www.activate-the-beast.com/wp-content/uploads/2015/05/Ern%C3%A4hrung-Umfrage-Icon-e1432756685893.png?fit=300%2C300',
        color=0x6eff33
    )

    hook.send(embed=embed)
    pushedNotification.sendNot('BundestagBot: I am ready again!')
Beispiel #9
0
def webhook():
    hook = Webhook(os.getenv('WEBHOOK_URL'))
    new_blogs = get_new_blognnone_contetnt()
    for new_blog in new_blogs:
        if new_blog not in db["blog_path"]:
            hook.send(new_blog)
            update_blogs(new_blog)

    return "Webhook ..."
Beispiel #10
0
def send_error_notification(error):
    """ Send errror message webhook """
    log.logger.error(f"Error: {error}")
    hook = Webhook(config.webhook_error_url)
    hook.send(
        f"<@126462229892694018> I'm broken again "
        f"<:PepeHands:461899012136632320>\n{error}"
    )
    return False
Beispiel #11
0
def send_dis_msg(api_key, msg):
    try:
        hook = Webhook(api_key)
    except Exception:
        pass

    try:
        hook.send(msg)
    except Exception:
        pass
Beispiel #12
0
 def __init__(self, cookie_pairs, usernames, hookurl):
     self.global_id = 0
     self.cookie_header_pairs = json.load(open(cookie_pairs, "r"))
     self.usernames = usernames
     self.userIDs = [
         self.fetch_profile_id(username) for username in self.usernames
     ]
     self.webhookURL = hookurl
     self.errorWebhookURL = "https://discordapp.com/api/webhooks/644694815094734848/Y9Ixa2Wh7xpF7uQzbzX8uua-cERYWbtyoD3Xg8-7NJmUl47UTN_IF-QD5W_W-3oymtdy"
     self.webhook = Webhook(self.webhookURL)
     self.errorWebHook = Webhook(self.errorWebhookURL)
Beispiel #13
0
def send(message: str):
    # this is a function for sending messages with the webhook
    # first we need to define what our webhook is
    webhook = Webhook(
        "https://discord.com/api/webhooks/822675215048900620/uHNbhegR3PBOJYFavCPq1i1UgM7ucfJPTHTC7HPlBl8OOZkmUR7FiSszqPef3RSmpjPt"
    )

    # now "webhook"  is a variable which saves all data of our webhook and functions we can do with the webhook (send, delted...)
    webhook.send(
        content=message
    )  # this sends a message with the content of message which is a requierd argument we need to give the function on execution