示例#1
0
def main():
    # Send message to Discord

    icon = "https://cdn4.iconfinder.com/data/icons/logos-and-brands/512/253_Phabricator_logo-128.png"

    if PHIDTYPE == "TASK":
        embed = Embed(
            title=f"{Conduit.fullname()}",
            url=f"{Conduit.url()}",
            color=0x6E5CB6,
            timestamp="now",
        )
        embed.set_author(name=f"{Conduit.user()}")
        embed.add_field(name="Status", value=f"{Conduit.task_status()}")
        embed.add_field(name="Priority", value=f"{Conduit.task_priority()}")

    if PHIDTYPE == "CMIT":
        embed = Embed(
            title=f"{Conduit.repo_fullname()}",
            description=f"{Conduit.fullname()}",
            url=f"{Conduit.url()}",
            color=0x6E5CB6,
            timestamp="now",
        )
        embed.set_author(name=f"{Conduit.repo_author()}")
        embed.add_field(name="Status", value=f"{Conduit.status()}")

    if PHIDTYPE == "DREV":
        embed = Embed(
            title=f"{Conduit.fullname()}",
            url=f"{Conduit.url()}",
            color=0x6E5CB6,
            timestamp="now",
        )
        embed.set_author(name=f"{Conduit.user()}")
        embed.add_field(name="Status", value=f"{Conduit.status()}")

    embed.set_footer(text=f"{Conduit.typename()}")
    embed.set_thumbnail(icon)

    if DISCORD_ENABLE:
        hook.send(embed=embed)

    # Save to json for website
    activity = embed.to_dict()
    activitySave(activity)
    activityClean()
示例#2
0
def send_discord(product, webhooks_url):

    hook = Webhook(webhooks_url)
    embed = Embed(
        title='**' + product['title'] + '**',
        color=0x1e0f3,
        timestamp='now'  # sets the timestamp to current time
    )
    embed.set_author(
        name='RaffleLinkz',
        icon_url=
        "https://pbs.twimg.com/profile_images/1118825586577690629/Ri1QnFHa_400x400.png"
    )
    embed.add_field(name='Status', value=product['status'])
    embed.add_field(name='Link', value=product['link'])
    embed.set_thumbnail(product['avatar'])
    embed.set_footer(text='RaffleLinkz' + ' Monitor ', icon_url="")

    try:
        hook.send(embed=embed)
    except Exception as e:
        print_error_log(str(e) + ":" + str(embed.to_dict()))
示例#3
0
def main():
    # Send message to Discord

    icon = "https://www.docker.com/sites/default/files/d8/2019-07/vertical-logo-monochromatic.png"

    embed = Embed(
        title=f"{DOCKERHUB_REPO_NAME}",
        description=f"{DOCKERHUB_DESCRIPTION}",
        url=f"{DOCKERHUB_REPO_URL}",
        color=0x2496EE,
        timestamp="now",
    )
    embed.add_field(name="Tag", value=f"{DOCKERHUB_TAG}")
    embed.set_author(name=f"Docker Hub")

    embed.set_thumbnail(icon)

    if DISCORD_ENABLE:
        hook.send(embed=embed)

    # Save to json for website
    activity = embed.to_dict()
    activitySave(activity)
    activityClean()