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 sendWebhook(self, nitroCode, startTime, success=False, errorCode=None): webhook = Webhook(os.environ["discordWebhook"]) if success == False: embedColor = 16724787 embedTitle = "Failed Claiming Nitro" else: embedColor = 9881393 embedTitle = "Claimed Discord Nitro" embed = Embed( title=embedTitle, color=embedColor, time="now" ) embed.add_field(name="Nitro Code", value=nitroCode, inline=True) embed.add_field(name="Elapsed time", value=str(time.time() - startTime) + " sec", inline=True) if success == False and errorCode != None: embed.add_field(name="Error code", value=errorCode, inline=True) embed.set_author(name="Andromeda") embed.set_footer(text="Andromeda - Made By Thoosje") try: webhook.send(embed=embed) except Exception: print(colored(getPrintFormat() + "Failed to send webhook.", "red")) return
def sendWebhook(self, inviteCode, startTime, success=False, guildName=None): webhook = Webhook(os.environ["discordWebhook"]) if success == False: embedColor = 16724787 embedTitle = "Failed Joining Guild" else: embedColor = 9881393 embedTitle = "Joined Guild" embed = Embed( title=embedTitle, color=embedColor, time="now" ) embed.add_field(name="Invite Code", value=inviteCode, inline=True) embed.add_field(name="Elapsed time", value=str(time.time() - startTime) + " sec", inline=True) if success == True and guildName != None: embed.add_field(name="Guild Name", value=guildName, inline=True) embed.set_author(name="Andromeda") embed.set_footer(text="Andromeda - Made By Thoosje") try: webhook.send(embed=embed) except Exception: print(colored(getPrintFormat() + "Failed to send webhook.", "red")) return
def sendHooks(value, type, link): stock = (value / 25) amount = math.floor(stock) if amount != 0: hook = Webhook( 'https://discordapp.com/api/webhooks/704560730749272064/jFr8w0aP5gxOZL0ImAJb53F94xWAxfezRk3cyD3Y9E0msBPSFwQSv_PpqR-g4XV3pupx' ) embed = Embed( #description='Oculus proxies restocked ' + str(numpacks) + " packs of " + type, color=0x5CDBF0, timestamp='now' # sets the timestamp to current time ) image1 = 'https://pbs.twimg.com/profile_images/1000760087546392576/UJBqUta8.jpg' image2 = 'https://pbs.twimg.com/profile_images/1000760087546392576/UJBqUta8.jpg' embed.set_author(name='Oculus Proxies Restock\n-->CLICK ME<--', icon_url=image1, url=link) embed.add_field(name='Type', value=type) embed.add_field(name='Amount\n(sold in 25x)', value=str(amount)) embed.set_footer(text='Made by @thecanoechief', icon_url=image1) embed.set_thumbnail(image1) embed.set_image(image2) hook.send("@everyone", embed=embed) print("Restock found for " + type + "\nWebhook executed") time.sleep(0.5)
def make_webhook(avatar, tweet, link_list, text): """Make webhook embed""" log.logger.debug(f"Tweet: {text}") hook = Webhook(config.webhook_url) embed = Embed( description=text, color=0x1E0F3, # Light blue timestamp="now", # Set the timestamp to current time ) embed.set_author( icon_url=avatar, name=tweet.user.screen_name, url=f"https://twitter.com/statuses/{tweet.id}", ) hook.send(embed=embed) # Add links under embed if link_list is not None: links = "\n".join([str(v) for v in link_list]) if links: hook.send(f"I found some links:\n{links}") log.logger.info("Posted.")
async def post_to_webhook(new_tweet: Tweet): start_time = time.time() url = "https://discordapp.com/api/webhooks/644694815094734848/Y9Ixa2Wh7xpF7uQzbzX8uua-cERYWbtyoD3Xg8-7NJmUl47UTN_IF-QD5W_W-3oymtdy" text = new_tweet.text webhook = Webhook.Async(url) embed = Embed( title=f"Link to tweet", url= f"https://twitter.com/{new_tweet.created_by.screen_name}/status/{new_tweet.id}" ) embed.set_author( name=f"New tweet from {new_tweet.created_by.screen_name}", url=f'https://twitter.com/{new_tweet.created_by.screen_name}', icon_url=new_tweet.created_by.profile_image_url) for mentioned_user in new_tweet.mentioned_users: text = text.replace( f"@{mentioned_user.screen_name}", f"[@{mentioned_user.screen_name}](https://twitter.com/{mentioned_user.screen_name})" ) embed.add_field(name="Content: ", value=text, inline=True) for url in new_tweet.links_in_tweet: embed.add_field(name="Link Found: ", value=f"{url.url}") embed.set_footer(text=f'Monitor by ike_on') await webhook.send(embed=embed) print(f"Took {time.time() - start_time} seconds to send to webhook") for url in new_tweet.links_in_tweet: if ("discord" in url.url): await webhook.send(f"Possible discord invite found: {url.url}") await webhook.close()
def bot(hookName, username): if hookName == "": pass else: hook = Webhook(hookName) embed = Embed( description="GITAM Meetings", color=0xB1040E, timestamp="now" ) embed.set_author(name="Meetings") with open('meet.csv', 'r') as file: reader = csv.reader(file) for row in reader: # print(row) title=row[0] dateandlink=row[1] + ", " + row[2] embed.add_field(name=title, value=dateandlink) footer = 'By ' + username embed.set_footer(text=footer) hook.send(embed=embed)
async def aexit(app, loop): em = Embed(color=Color.orange) em.set_footer(f'Host: {socket.gethostname()}') em.set_author('[INFO] Server Stopped') await app.webhook.send(embed=em) await app.session.close()
def detect_post(self): hook = Webhook(self.hook) embed = Embed(description='New post detected.', color=0x5CDBF0, timestamp='now') embed.set_author(name='Instagram Monitor') embed.add_field( name='User', value=f"[{self.user}](https://www.instagram.com/{self.user})", inline=False) embed.add_field(name='Link', value=f"https://www.instagram.com/p/{self.post_url}/", inline=False) embed.set_thumbnail(self.profile_pic_link) if self.post_caption: embed.add_field(name='Caption', value=self.post_caption, inline=False) else: embed.add_field(name='Caption', value="\u274C No caption", inline=False) if len(self.post_image) == 1: embed.set_image(self.post_image[0]) hook.send(embed=embed) else: embed.set_image(self.post_image[0]) hook.send(embed=embed) for i in range(1, len(self.post_image)): embed = Embed(description=f"{i+1}/{len(self.post_image)}", color=0x5CDBF0, timestamp='now') embed.set_image(self.post_image[i]) hook.send(embed=embed)
def SendOutWebhook(): embed = Embed( title="KITH MOSAIC TEE/SLATE(并没有补货)", url= "https://kith.com/collections/kith-monday-program/products/kith-mosaic-tee-slate", description="In Stock Now!", color=6940159, timestamp="now", ) hook = Webhook( "https://ptb.discordapp.com/api/webhooks/665206935125098496/5nqd6ABS3So5UVCRle7nZIqhJ8wRLFPCBbTReW9MqC6l8A9zYiUe4TlRCwbTMtn0Ov_u" ) embed.add_field( name="商品页面", value= "https://cdn.shopify.com/s/files/1/0094/2252/products/KH3777-105-2_300x300.jpg?v=1590786070" ) embed.set_author( name="eee7272的小小monitor", icon_url= "https://cdn.discordapp.com/avatars/677904239527329817/a5fb74580580dd6d3354e8ecd7f136ee.png?size=128" ) embed.set_image( "https://cdn.shopify.com/s/files/1/0094/2252/products/KH3777-105_200x200_crop_center.jpg?v=1590786070" ) embed.set_footer( text="eee7272#6012", icon_url= "https://cdn.discordapp.com/avatars/677904239527329817/a5fb74580580dd6d3354e8ecd7f136ee.png?size=128" ) hook.send(embed=embed)
async def on_ready(self): if not hasattr(self.bot, "uptime"): self.bot.uptime = datetime.utcnow() webhook = Webhook(self.config.readywebhook, is_async=True) embed = Embed( title=f"Reconnected, Online and Operational!", description="Ready Info", color=5_810_826, timestamp=True, ) embed.set_author( name=f"PawBot", url= "https://discordapp.com/oauth2/authorize?client_id=460383314973556756&scope=bot&permissions=469888118", icon_url= "https://cdn.discordapp.com/avatars/460383314973556756/2814a7328962f7947a25ccd2ee177ac1.webp", ) embed.add_field(name="Guilds", value=f"**{len(self.bot.guilds)}**", inline=True) embed.add_field(name="Users", value=f"**{len(self.bot.users)}**", inline=True) await webhook.execute(embeds=embed) await webhook.close() await self.bot.change_presence( activity=discord.Game( type=0, name=f"{random.choice(lists.randomPlayings)} | paw help"), status=discord.Status.online, )
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)
async def post_to_webhook(self, new_tweet: Tweet): start_time = time.time() text = new_tweet.text webhook = Webhook.Async(self.webhookURL) embed = Embed( title=f"Link to tweet", url= f"https://twitter.com/{new_tweet.created_by.screen_name}/status/{new_tweet.id}" ) embed.set_author( name=f"New tweet from {new_tweet.created_by.screen_name}", url=f'https://twitter.com/{new_tweet.created_by.screen_name}', icon_url=new_tweet.created_by.profile_image_url) for mentioned_user in new_tweet.mentioned_users: text = text.replace( f"@{mentioned_user.screen_name}", f"[@{mentioned_user.screen_name}](https://twitter.com/{mentioned_user.screen_name})" ) embed.add_field(name="Content: ", value=text, inline=True) for url in new_tweet.links_in_tweet: embed.add_field(name="Link Found: ", value=f"{url.url}") embed.set_footer( text= f'Monitor by ike_on not recursive {datetime.now().strftime("%I:%M:%S.%f %p")}' ) await webhook.send(embed=embed) print(f"Took {time.time() - start_time} seconds to send to webhook") for url in new_tweet.links_in_tweet: if ("discord" in url.url): await webhook.send(f"Possible discord invite found: {url.url}") await webhook.close()
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)
def notify_password_url(webhook_url, password_url, screen_name, profile_pic): hook = Webhook(url=webhook_url) color = random.choice(HEX_LIST) embed = Embed( title="Possible link found:", color=color, timestamp='now', description=password_url, ) embed.set_author(name=screen_name, icon_url=profile_pic, url=f'https://twitter.com/{screen_name}') embed.set_footer( text= f'BONZAY Twitter • {datetime.datetime.now().strftime("%Y-%m-%d %H:%M")}', icon_url='https://cdn.discordapp.com/emojis/636516489322561536.png?v=1' ) # if url: # embed.add_field('Link in tweet', value=url) #embed.set_author(name='New post by {instagram_user}') # if tweet_content: # embed.add_field("Tweet description", tweet_content) # embed.image(image) hook.send(embed=embed)
async def init(app, loop): """Sends a message to the webhook channel when server starts.""" app.session = aiohttp.ClientSession(loop=loop) # to make web requests app.webhook = Webhook.Async(webhook_url, session=app.session) em = Embed(color=0x2ecc71) em.set_author('[INFO] Starting Worker') em.description = 'Host: {}'.format(socket.gethostname()) await app.webhook.send(embed=em)
def notify(updatedata, length): embed = Embed(title="Weekly Challenge Update", description=f"New song is \"{updatedata}\" ({length})", color=0x99beea, timestamp='now') embed.set_author( name="Arrow Tracker", icon_url= "https://arrowtracker.duckdns.org/static/newlogo-arrow-smaller.png") hook.send(embed=embed)
def detect_profile_pic(self): hook = Webhook(self.hook) embed = Embed(description='New profile picture detected.', color=0x5CDBF0, timestamp='now') embed.set_author(name='Instagram Monitor') embed.add_field( name='User', value=f"[{self.user}](https://www.instagram.com/{self.user})", inline=False) embed.set_image(self.profile_pic_link) hook.send(embed=embed)
def restrict(fro, chan, message): # Get parameters for i in message: i = i.lower() target = message[0] reason = ' '.join(message[1:]) # Make sure the user exists targetUserID = userUtils.getIDSafe(target) username = chat.fixUsernameForBancho(fro) userID = userUtils.getID(fro) if not targetUserID: return "{}: user not found".format(target) if targetUserID < 1002 and userID > 1002: log.enjuu("{} attempted to restrict immortal user {}.".format(username, targetUserID), discord="cm") return "Nice try." if not reason: reason = "not avialable" # Put this user in restricted mode userUtils.restrict(targetUserID) # Send restricted mode packet to this user if he's online targetToken = glob.tokens.getTokenFromUsername(userUtils.safeUsername(target), safe=True) if targetToken is not None: targetToken.setRestricted() log.rap(userID, "has restricted {} ({}) for: {}".format(target, targetUserID, reason), True) hook = Webhook(glob.conf.config["discord"]["webhook"]) embed = Embed( description='', color=0x1e0f3, timestamp='now' # sets the timestamp to current time ) avatar = "https://a.enjuu.click/" embed.set_author(name='Restriction', icon_url="https://a.enjuu.click/{}".format(targetUserID)) embed.add_field(name='Username', value="{}".format(target)) embed.add_field(name='Reason', value="{}".format(reason)) embed.set_footer(text="Restricted by {}".format(username)) embed.set_thumbnail("https://a.enjuu.click/{}".format(targetUserID)) hook.send(embed=embed) return "{} has been restricted for {}".format(target, reason)
async def init(app, loop): app.secret = config.SECRET app.session = aiohttp.ClientSession( loop=loop) # we use this to make web requests app.webhook = Webhook.Async(config.WEBHOOK_URL, session=app.session) app.db = AsyncIOMotorClient(config.MONGO_URI).majorproject app.users = UserBase(app) em = Embed(color=Color.green) em.set_author('[INFO] Starting Worker', url=app.ngrok_url) em.set_footer(f'Host: {socket.gethostname()}') em.add_field('Public URL', app.ngrok_url) if app.ngrok_url else ... await app.webhook.send(embed=em)
def notify_discord_invite(webhook_url, invite_url, screen_name, profile_pic): hook = Webhook(url=webhook_url) color= random.choice(HEX_LIST) embed = Embed( title = "Discord invite found:", color=color, description = invite_url, ) embed.set_author(name=screen_name,icon_url=profile_pic,url=f'https://twitter.com/{screen_name}') embed.set_footer(text='BONZAY', icon_url="https://cdn.discordapp.com/emojis/636516489322561536.png?v=1") hook.send(embed=embed)
def send_hook(url_, name_, price_, _avail): embed = Embed( description="A restock has Occurred", timestamp='now' ) url = url_ image1 = "https://i.imgur.com/pUhfYFF.png" embed.set_author(name="Stock Alert!", icon_url="https://i.imgur.com/YCOZANm.png") embed.add_field(name="Amazon" + " Has Restocked", value=name_) embed.add_field(name="Price", value=price_) embed.add_field(name="Availability", value=_avail) embed.set_footer(text="SET TO YOUR LINK!", icon_url=image1) embed.set_thumbnail(image1) embed.set_image("https://bgr.com/wp-content/uploads/2020/09/amazon-logo-sign.jpg?quality=70&strip=all&w=640&h=500&crop=1") hook.send(embed=embed)
def post_discord(purl, title, price, image, available_sizes): hook = Webhook(webhook_url) embed = Embed(description='', color=0x5CDBF0, timestamp='now') embed.set_author(name='Custom Shopify Monitor', icon_url='') embed.set_title(title=title, url=purl) embed.set_footer( text='@zyx898', icon_url= 'https://pbs.twimg.com/profile_images/1201960848073383937/XzQhFIiM_400x400.jpg' ) embed.add_field(name='Link', value=purl, inline=True) embed.add_field(name='Stock', value=" | ".join(available_sizes), inline=False) embed.set_thumbnail(image) hook.send(embed=embed)
async def on_message(message): if message.author == client.user: return if int(message.channel.id) != 782648561031446550: return #if message.channel.id == "782648561031446550" #calculation function with course if message.content.startswith('$help'): print(message.author.id) await message.channel.send("Hi") if message.content.startswith('$calc'): usertxt = message.content.split(" ") try: if usertxt[1] == "c": await message.channel.send(create_course()) else: price = float(usertxt[1]) await message.channel.send(create_price(price)) except: await message.channel.send( 'Неправильно задана команда или параметр!') if message.content.startswith('$atc'): try: usertxt = message.content.split(" ") link = usertxt[1] product_info = create_atc(link) embed = Embed( description='Your **ATC** is created! :smiley:', color=0x5CDBF0, timestamp='now') # sets the timestamp to current time image1 = product_info[1] embed.set_author(name=product_info[0]) embed.add_field(name='ATC', value=product_info[2]) print(product_info[2]) embed.add_field(name='ATC', value=product_info[3]) embed.add_field(name='ATC', value=product_info[4]) embed.set_footer(text='Suck AIO v1.0') embed.set_thumbnail(image1) hook.send(embed=embed) except: await message.channel.send( "Неправильно задана команда или параметр!")
def CreateWebHook(name, sizes, price): webhook = Webhook("WEBHOOK_URL") embed = Embed( description='A new thing is out! :wink:', timestamp='now' ) #Making a Discord Webhook embed.set_author(name=name, icon_url="https://pmcfootwearnews.files.wordpress.com/2016/12/sns-logo-black_1024x1024.jpg") embed.add_field(name='**Sizes**', value='[S](https://www.sneakersnstuff.com/en/product/40044/adidas-pleckgate-tp),' ' [M](https://www.sneakersnstuff.com/en/product/40044/adidas-pleckgate-tp),' ' [L](https://www.sneakersnstuff.com/en/product/40044/adidas-pleckgate-tp),' ' [XL](https://www.sneakersnstuff.com/en/product/40044/adidas-pleckgate-tp)') #embed.set_thumbnail("./product.png") webhook.send(embed=embed) print('webhook sent') pass
def tune_embed_message(self): embed = Embed( description='不定期更新! :poop:', color=0x1e0f3, timestamp='now' # sets the timestamp to current time ) image0 = 'https://i.imgur.com/rdm3W9t.png' image1 = 'https://tw.beanfun.com/maplestory/image/Board/category/72.gif' embed.set_author(name='近期活動公告', icon_url=image0) for ele in self.anno_dict.keys(): embed.add_field(name=ele, value=self.anno_dict[ele]) #embed.set_footer(text='Here is my footer text', icon_url=image1) embed.set_thumbnail(image1) embed.set_image(self.bottom_image) return embed
def run(self): self.loop = asyncio.new_event_loop() asyncio.set_event_loop(self.loop) n = 2 max_i = len(self.cookie_header_pairs) # i = random.randint(0, (max_i - 1)) i = 0 print(f"Using cookies {i}") proxy_list = get_proxy_list() max_j = len(proxy_list) j = random.randint(0, (max_j - 1)) proxy = proxy_list[j] j = 0 while (True): all_groups = asyncio.gather(*[ self.get_recent(self.userIDs[j], self.usernames[j], proxy, i) for j in range(len(self.usernames)) ]) print("---------") start_time = time.time() try: self.loop.run_until_complete(all_groups) except Exception as e: embed = Embed(title="Error Logger", color="Red") embed.set_author("Twitter Monitor") embed.add_field(name=f"{repr(e)}", value=str(e)) embed.add_field(name="Stack Trace", value=traceback.format_exc()) embed.add_field( name="Cookie info", value=f"Cookie {i} not working. Switching cookies and proxy" ) print(f"Cookie {i} not working. Switching cookies and proxy") print(traceback.format_exc()) j = random.randint(0, (max_j - 1)) if (i >= max_i): i = 0 else: i += 1 print(f"Using cookies {i} and proxy {proxy_list[j]}") embed.add_field( name="New Cookie & Proxy", value=f"Using cookies {i} and proxy {proxy_list[j]}") self.errorWebHook.send(embed=embed)
async def on_guild_remove(self, guild): findbots = sum(1 for member in guild.members if member.bot) findusers = sum(1 for member in guild.members if not member.bot) webhook = Webhook(self.config.guildleavewebhook, is_async=True) embed = Embed(description=f"I've left {guild.name}...", color=5_810_826, timestamp=True) embed.set_author( name=f"{guild.name}", url= "https://discordapp.com/oauth2/authorize?client_id=460383314973556756&scope=bot&permissions=469888118" ) embed.add_field( name="Info", value= f"New guild count: **{len(self.bot.guilds)}**\nOwner: **{guild.owner}**\nUsers/Bot Ratio: **{findusers}/{findbots}**", ) await webhook.execute(embeds=embed, username=guild.name) await webhook.close()
def webhook(self, patch_notes_url, discord_webhook): """ Sends POST request to the specified webhook URL, posts in a neat fashion """ hook = Webhook(discord_webhook) embed = Embed( description= "Epic just released the new patch notes, check them out above!", color=0x1e0f3, timestamp="now") embed.set_author(name="New Fortnite Patch Notes", url=patch_notes_url) embed.set_footer(text="Fortnite Patch Notes V1 | by @visuxls") hook.send(embed=embed)
def detect_private(self): hook = Webhook(self.hook) if self.private: desc = "Profile changed to private." elif not self.private: desc = "Profile changed to public." else: self.log.error("Privacy was never set.") embed = Embed(description="Privacy change detected.", color=0x5CDBF0, timestamp='now') embed.set_author(name='Instagram Monitor') embed.add_field( name='User', value=f"[{self.user}](https://www.instagram.com/{self.user})", inline=False) embed.add_field(name='Status', value=desc, inline=False) embed.set_thumbnail(self.profile_pic_link) hook.send(embed=embed)