Ejemplo n.º 1
0
def send_webhook(item, webhook_hide_sensitive_info, webhook_links, category,
                 category2: str):
    if category == "auth_webhook":
        for webhook_link in webhook_links:
            auth = item
            username = auth.username
            if webhook_hide_sensitive_info:
                username = "******"
            message = prepare_webhooks.discord()
            embed = message.embed()
            embed.title = f"Auth {category2.capitalize()}"
            embed.add_field("username", username)
            message.embeds.append(embed)
            message = ujson.loads(
                json.dumps(message, default=lambda o: o.__dict__))
            x = requests.post(webhook_link, json=message)
    if category == "download_webhook":
        subscriptions = item.get_subscriptions(refresh=False)
        for subscription in subscriptions:
            download_info = subscription.download_info
            if download_info:
                for webhook_link in webhook_links:
                    message = prepare_webhooks.discord()
                    embed = message.embed()
                    embed.title = f"Downloaded: {subscription.username}"
                    embed.add_field("username", subscription.username)
                    embed.add_field("post_count", subscription.postsCount)
                    embed.add_field("link", subscription.link)
                    embed.image.url = subscription.avatar
                    message.embeds.append(embed)
                    message = ujson.loads(
                        json.dumps(message, default=lambda o: o.__dict__))
                    x = requests.post(webhook_link, json=message)
                    print
Ejemplo n.º 2
0
def send_webhook(item):
    for webhook_link in webhooks:
        message = prepare_webhooks.discord()
        embed = message.embed()
        embed.title = f"Downloaded: {item.username}"
        embed.add_field("username", item.username)
        embed.add_field("post_count", item.postsCount)
        embed.add_field("link", item.link)
        embed.image.url = item.avatar
        message.embeds.append(embed)
        message = json.loads(json.dumps(message, default=lambda o: o.__dict__))
        x = requests.post(webhook_link, json=message)