def _format_date(date, timezone=None): from pytz import reference if timezone is None: timezone = reference.LocalTimezone() if date.tzinfo is None: date = date.replace(tzinfo=reference.LocalTimezone()) return date.astimezone(timezone).strftime('%Y-%m-%d %H:%M')
def find_torrent(self, torrent_hash): parameters = self._get_params() if not parameters: return False try: # qbittorrent uses case sensitive lower case hash torrent_hash = torrent_hash.lower() torrents = parameters['session'].get(parameters['target'] + "query/torrents") array = json.loads(torrents.text) torrent = next(torrent for torrent in array if torrent['hash'] == torrent_hash) if torrent: time = torrent.get('added_on', None) result_date = None if time is not None: if isinstance(time, six.string_types): result_date = dateutil.parser.parse(time).replace(tzinfo=reference.LocalTimezone())\ .astimezone(utc) else: result_date = datetime.fromtimestamp(time, utc) return {"name": torrent['name'], "date_added": result_date} except Exception as e: return False
def test_write_footer(): now = datetime.datetime.now() tz = reference.LocalTimezone().tzname(now) date = now.strftime('%H:%M {} on %d %B %Y'.format(tz)) out = html.write_footer() assert parse_html(str(out)) == parse_html( HTML_FOOTER.format(user=getuser(), date=date))
class LectureDumpSchema(IdSchema): name = fields.Str() aliases = fields.List(fields.Str()) comment = fields.Str() validated = fields.Boolean() early_document_until = fields.AwareDateTime(default_timezone=reference.LocalTimezone()) early_document_eligible = fields.Boolean()
def create(self, groundstation, operation, periodicity, dates): """ This method creates a new object in the database. :param groundstation: reference to the ground station for the rule :param operation: type of operation (create or remove slots) :param periodicity: periodicity for the rule (once, daily, weekly) :param dates: applicability dates for the rule """ localtime = pytz_ref.LocalTimezone() starting_tz = localtime.tzname(dates[0]) ending_tz = localtime.tzname(dates[1]) if starting_tz != ending_tz: raise ValueError('Invalid ONCE rule, TZ differ: ' + '( starting_tz = ' + starting_tz + 'ending_tz = ' + ending_tz + ' )') starting_dt = dates[0].astimezone(pytz.utc) ending_dt = dates[1].astimezone(pytz.utc) if ending_dt <= starting_dt: raise ValueError('Invalid ONCE rule, ending (' + ending_dt.isoformat() + ') ' + '<= starting (' + starting_dt.isoformat() + ')') return super(AvailabilityRuleOnceManager, self).create(groundstation=groundstation, operation=operation, periodicity=periodicity, starting_date=starting_dt, ending_date=ending_dt, starting_time=starting_dt, ending_time=ending_dt)
def conv_longdate_to_str(longdate, local_tz=True): date_time = datetime.datetime.fromtimestamp(longdate / 1000.0) str_long_date = date_time.strftime('%Y-%m-%d %H:%M:%S') if local_tz: str_long_date += " " + reference.LocalTimezone().tzname(date_time) return str_long_date
def getInfo(name): SYMBOL_URL="https://www.alphavantage.co/query?function=OVERVIEW&symbol="+name+"&apikey="+"E1NGKWLLXPZE46U4" DETAILS_URL="https://www.alphavantage.co/query?function=GLOBAL_QUOTE&symbol="+name+"&apikey="+"E1NGKWLLXPZE46U4" response={} try: response = requests.get(SYMBOL_URL).json() print("hell") localtime = reference.LocalTimezone() data["Date"]=datetime.now().strftime("%a, %b %d %H:%M:%S, " + localtime.tzname(datetime.now())+" %Y") data["Name"]=response["Name"]+"("+ response["Symbol"]+")" response = requests.get(DETAILS_URL).json() print(response) data["Price"]=response["Global Quote"]["05. price"] change=float(response["Global Quote"]["09. change"]) # data["valueChange"]="+"+str(change) if change>0 else "-"+str(change) percentChange=response["Global Quote"]["10. change percent"] # data["percentChange"]=percentChange if float(percentChange[0:len(percentChange)-1])>0 else percentChange data["Value Change"]= "+"+str(change) if change>0 else change data["Percent Change"]="+"+percentChange if float(percentChange[0:len(percentChange)-1])>0 else percentChange return data except : print(sys.exc_info()[0]) if(len(response) == 0): return "Please enter a valid symbol" else: return "Network error, please try again after sometime"
def timer_once_per_second(self): if self.enabled and self.connected == False and self.conninprogress == False: self.conninprogress = True self.connect() if self.connected: self.initialized = True self.ports = str(self.taskdevicepluginconfig[0]) self._lastdataservetime = rpieTime.millis() - ( (self.interval - 1) * 1000) self.timer1s = False self.conninprogress = False if self.enabled and self.connected: if self.taskdevicepluginconfig[2]: try: if (time.time() - self._lastclockupdate) > 604800: misc.addLog(rpieGlobals.LOG_LEVEL_DEBUG, "Sync LWSD02 time") try: from pytz import reference localtime = reference.LocalTimezone() today = datetime.now(localtime) self.BLEPeripheral.tz_offset = localtime.utcoffset( today).seconds // 3600 #set timezone except Exception as e: today = datetime.now() self.BLEPeripheral.time = today self._lastclockupdate = time.time() except Exception as e: self._lastclockupdate = 0
def write_footer(about=None, link=None, issues=None, content=None): """Write a <footer> for a bootstrap page Parameters ---------- about : `str`, optional path of about page to link link : `str`, optional HTML link to software name and version issues : `str`, optional HTML link to issue report page content : `str` or `~MarkupPy.markup.page`, optional additional footer content Returns ------- page : `~MarkupPy.markup.page` the markup object containing the footer HTML """ page = markup.page() page.twotags.append('footer') markup.element('footer', case=page.case, parent=page)(class_='footer') page.div(class_='container') # write user/time for analysis if link is None: version = get_versions()['version'] commit = get_versions()['full-revisionid'] url = 'https://github.com/gwdetchar/gwdetchar/tree/{}'.format(commit) link = markup.oneliner.a('View gwdetchar-{} on GitHub'.format(version), href=url, target='_blank') if issues is None: report = 'https://github.com/gwdetchar/gwdetchar/issues' issues = markup.oneliner.a('Report an issue', href=report, target='_blank') page.div(class_='row') page.div(class_='col-md-12') now = datetime.datetime.now() tz = reference.LocalTimezone().tzname(now) date = now.strftime('%H:%M {} on %d %B %Y'.format(tz)) page.p('This page was created by {user} at {date}.'.format(user=getuser(), date=date)) page.p('{link} | {issues}'.format(link=link, issues=issues)) # link to 'about' if about is not None: page.a('How was this page generated?', href=about) # extra content if isinstance(content, markup.page): page.add(str(content)) elif content is not None: page.p(str(content)) page.div.close() # col-md-12 page.div.close() # row page.div.close() # container markup.element('footer', case=page.case, parent=page).close() return page()
def bigdb_iso_8601_date(value, schema, detail, bigdb): # iso_8601 time stamps, in a string. utc_time = datetime.datetime(*(time.strptime( value, "%Y-%m-%dT%H:%M:%S.%fZ")[0:6]), tzinfo=pytz.utc) local_zone = reference.LocalTimezone() this_time = utc_time.astimezone(local_zone) return this_time.strftime("%Y-%m-%d %H:%M:%S %Z")
def start_server(address, port, max_connections=5): # We're using TCP/IP as transport server_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) # Bind to the given address and port server_socket.bind((address, port)) # Listen for incoming connection (with max connections) server_socket.listen(max_connections) print("=== Listening for connections at %s:%s" % (address, port)) while True: # Accept an incomming connection # Note: this is blocking and synchronous processing of incoming connection incoming_socket, address = server_socket.accept() print("=== New connection from %s" % (address, )) # Recv up to 1kB of data data = incoming_socket.recv(1024) print(">>> Received data %s" % (data, )) if (data[0] == '/'): command = data[1:] if command == 'help': string_response = '\n' for i in range(len(ListOfCommands)): string_response = string_response + ListOfCommands[i] + '\n' incoming_socket.send(string_response) incoming_socket.close() elif command == 'flip': coin = random.randint(1, 2) coinText = "" if (coin == 1): coinText = "Heads" else: coinText = "Tails" incoming_socket.send("Coin has been flipped : " + coinText) incoming_socket.close() elif command == 'random_name': random_name = random.choice(first_names) + " " + random.choice( last_names) incoming_socket.send('Your random generated name : ' + random_name) incoming_socket.close() elif command == 'timezone': today = datetime.datetime.now() localtime = reference.LocalTimezone() timezone = localtime.tzname(today) incoming_socket.send('Servers timezone : ' + timezone) incoming_socket.close() else: list_of_commands = command.split() if (list_of_commands[0] == 'hello'): incoming_socket.send(command[6:]) else: incoming_socket.send('No such function') incoming_socket.close() else: incoming_socket.send( 'Error 404 : Functions starts with / by instructions') incoming_socket.close()
def zonaHoraria(): import datetime import time now = datetime.datetime.now() from pytz import reference localtime = reference.LocalTimezone() localtime.tzname(now) zona = -time.timezone / 3600 return zona
def test_write_footer(): now = datetime.datetime.now() tz = reference.LocalTimezone().tzname(now) date = now.strftime('%H:%M {} on %d %B %Y'.format(tz)) out = html.write_footer(about='about', external='external') assert parse_html(str(out)) == parse_html( HTML_FOOTER.format(user=getuser(), date=date)) with pytest.raises(ValueError) as exc: html.write_footer(link='test') assert 'argument must be either None or a tuple' in str(exc.value)
def find_torrent(self, torrent_hash): client = self.check_connection() if not client: return False try: torrent = client.get_torrent(torrent_hash.lower(), ['id', 'hashString', 'addedDate', 'name']) return { "name": torrent.name, "date_added": torrent.date_added.replace(tzinfo=reference.LocalTimezone()).astimezone(utc) } except KeyError: return False
def test_close_page(tmpdir): target = os.path.join(str(tmpdir), 'test.html') now = datetime.datetime.now() tz = reference.LocalTimezone().tzname(now) date = now.strftime('%H:%M {} on %d %B %Y'.format(tz)) page = html.close_page(html.markup.page(), target) assert parse_html(str(page)) == parse_html( HTML_CLOSE.format(user=getuser(), date=str(date))) assert os.path.isfile(target) with open(target, 'r') as fp: assert fp.read() == str(page) shutil.rmtree(target, ignore_errors=True)
def record_request(self, method): (client_addr, client_port) = self.client_address # Python datetime are "naive", so we have to get our timezone by hand tz = reference.LocalTimezone() now = datetime.datetime.now(tz) content_length = self.headers.getheader('Content-Length') body = self.rfile.read(int(content_length)) if content_length else u'-' # Prepare request info request = { 'timestamp': now.isoformat(), 'local_time': now.strftime('%d/%b/%Y:%H:%M:%S%z'), 'request_method': method, 'time_msec': time.time(), 'remote_addr': client_addr, 'user_agent': self.headers.getheader('User-Agent') or '', 'x_forwarded_for': self.headers.getheader('X-Forwarded-For') or u'', 'body': body.decode('utf-8'), 'headers': {} } for header_line in self.headers.headers: name, value = header_line.split(':', 1) request['headers'][name] = value.strip() parts = re.match(r'http[s]*://([\w\d\.\:\-]+)/(.+)?', self.path) request['request'] = u'%s %s %s' % (method, parts.group(1), self.request_version) client_method = getattr(requests, method.lower()) resp = client_method(self.path, headers=request['headers']) request['status'] = resp.status_code # We need to return received data to client, as if nothing happened. self.send_response(resp.status_code) for header, value in resp.headers.items(): if header == 'content-encoding' or header == 'content-length': continue self.send_header(header, value) self.end_headers() # python-requests decompresses content received from server, # so to make sense we must send it raw body of the response self.wfile.write(resp.content) self.wfile.flush() sys.stdout.write(json.dumps(request)) sys.stdout.flush()
def games_by_spread(bot, trigger): vdb = vegasdb.VegasDb('vegas.db') lines = vdb.games_by_spread() ltz = reference.LocalTimezone() output = [] for line in lines: d = line[0].astimezone(ltz) if line[3] is None and line[4] is None and line[5] is None: continue message = '%s (%0.1f) @ %s (%0.1f) %0.1fo/u %s' % ( line[1], line[3] if line[3] is not None else 0, line[2], line[4] if line[4] is not None else 0, line[5] if line[5] is not None else 0, d.strftime('%I:%M%p %A %b %d, %Y')) output.append(message) say_multiline(bot, '\n'.join(output))
def group_events(events): today = datetime.datetime.now(tz=reference.LocalTimezone()) past_events = [] upcoming_events = [] for event in events: if event['start'] < today: upcoming_events.append(event) else: past_events.append(event) past_events.sort(key=lambda e: e['start']) upcoming_events.sort(key=lambda e: e['start']) return past_events, upcoming_events
async def on_member_remove(self, m): localtime = reference.LocalTimezone() if m.guild == self.bot.jpServ: emb = discord.Embed( description='' f":outbox_tray: **{m.name}#{m.discriminator}** has `left` the server. " f"({m.id})", colour=0xD12B2B, timestamp=datetime.now(tz=localtime) ) emb.set_footer( text=f'User Leave ({self.bot.jpServ.member_count})', icon_url=m.avatar_url_as(static_format="png") ) await self.bot.jpEverything.send(embed=emb)
def getPlot(self, params): df = self.getData(params) col = params['barchart'] df = pd.DataFrame(df.groupby(['Name'])[col].mean()) df = df.sort(columns=col) localtime = reference.LocalTimezone() tz = localtime.tzname(datetime.datetime.now()) plt_obj = df.plot(kind='barh', legend=False) plt_obj.set_ylabel('') plt_obj.set_xlabel('Average ' + col) plt_obj.set_title('20 Most Recent Tweets (' + self.today_cache + ' ' + tz + ')') # set xlims for specific columns if col == 'Polarity' or col == 'Certainty': x1, x2, y1, y2 = plt_obj.axis() plt_obj.axis((x1, 1.0, y1, y2)) elif col == 'Subjectivity': plt_obj.set_xlim([0, 1.0]) return plt_obj
def current_timestamp() -> str: # timestamp format like 2019-04-15_11-29-51 current_seconds = time.time() # correct to local timezone (PDT) if running on AWS (which is UTC) import datetime from pytz import reference localtime = reference.LocalTimezone() today = datetime.datetime.now() timezone = localtime.tzname(today) # TODO(y): use pytz for proper timezone conversion instead of -= if timezone == 'UTC': current_seconds -= 7 * 3600 else: assert timezone == 'PDT' time_str = time.strftime('%Y-%m-%d_%H-%M-%S', time.localtime(current_seconds)) return time_str
def spread(bot, trigger): vdb = vegasdb.VegasDb('vegas.db') team = nfldb.standard_team(trigger.group(2)) if team == 'UNK': bot.reply("No team matching that name could be found") return line = vdb.get_line(format_team(team)) if line is None: bot.say('sorry i do not have a line for that game at this time') ltz = reference.LocalTimezone() d = line[0].astimezone(ltz) if line[3] is None and line[4] is None and line[5] is None: bot.say('sorry i do not have a line for that game at this time') return message = '%s (%0.1f) @ %s (%0.1f) %0.1fo/u %s' % ( line[1], line[3] if line[3] is not None else 0, line[2], line[4] if line[4] is not None else 0, line[5] if line[5] is not None else 0, d.strftime('%I:%M%p %A %b %d, %Y')) bot.say(message)
def update_venues(db, config, folder, reset=False): global country_dict venue_files = sorted(os.listdir(folder)) country_dict = dict(db.query("SELECT code, id FROM geo_country")) if reset: logger.log(Logger.INFO, "Reseting timestamp updates... ") db.execute("UPDATE " + DBSPEC.TB_VENUE + " SET date_time_updated = NULL") logger.log(Logger.INFO, "Reseting timestamp updates... SUCCESS!") logger.log(Logger.INFO, "Deleting category links... ") db.execute("DELETE FROM " + DBSPEC.TB_VENUE_CATEGORY) logger.log(Logger.INFO, "Deleting category links... SUCCESS!") db.commit() for file in venue_files: file_path = folder + "/" + file foursquare_id = file.replace(".json", "") localtime = reference.LocalTimezone() modified_timestamp = datetime.fromtimestamp( os.path.getmtime(file_path)) modified_timestamp = modified_timestamp.replace(tzinfo=localtime) data = None with open(file_path) as f: data = json.load(f) if is_up_to_date(db, foursquare_id, modified_timestamp): logger.log_dyn( Logger.WARNING, "Venue '" + foursquare_id + "' is up to date. Skipping...") continue try: update_venue(db, foursquare_id, data, modified_timestamp) except Exception as e: db.rollback() logger.log(Logger.ERROR, str(e)) logger.log(Logger.INFO, "All venues updated!")
def find_torrent(self, torrent_hash): path = self.check_connection() if not path: return False files = os.listdir(path) for torrent_file in files: file_path = os.path.join(path, torrent_file) if torrent_file.endswith(".torrent") and os.path.isfile(file_path): try: try: torrent = Torrent.from_file(file_path) except: continue if torrent.info_hash == torrent_hash: date_added = datetime.fromtimestamp(os.path.getctime(file_path))\ .replace(tzinfo=reference.LocalTimezone()).astimezone(utc) return {"name": torrent_file, "date_added": date_added} except OSError: continue return False
def test_find_torrent(self): torrent_filename = 'Hell.On.Wheels.S05E02.720p.WEB.rus.LostFilm.TV.mp4.torrent' torrent_filepath = self.get_httpretty_filename(torrent_filename) torrent = Torrent.from_file(torrent_filepath) plugin = DownloaderPlugin() settings = {'path': self.downloader_dir} self.assertFalse(plugin.find_torrent(torrent.info_hash)) plugin.set_settings(settings) self.assertFalse(plugin.find_torrent(torrent.info_hash)) downloaded_filepath = os.path.join(self.downloader_dir, torrent_filename) if not os.path.exists(self.downloader_dir): os.makedirs(self.downloader_dir) shutil.copy(torrent_filepath, downloaded_filepath) find_torrent = plugin.find_torrent(torrent.info_hash) self.assertNotEqual(False, find_torrent) date_added = datetime.fromtimestamp(os.path.getctime(downloaded_filepath))\ .replace(tzinfo=reference.LocalTimezone()).astimezone(utc) expected = {'name': torrent_filename, 'date_added': date_added} self.assertEqual(expected, find_torrent)
def log(message: str, level: int = DEFAULT_MESSAGE_LEVEL, logger_name: str = "gui_log"): """ Logs the given message at the given level in the given log. These are all available as module level variables :param str message: The message to log :param str level: The logging level to write as. :param str logger_name: The name of the logger to write to """ # We want to make sure that we're using a valid level; if it isn't in our approved list, we use the level # equivalent to "uh...I dunno..." since we just want to write if level is None or level not in [CRITICAL_LEVEL, ERROR_LEVEL, WARNING_LEVEL, INFO_LEVEL, DEBUG_LEVEL]: level = UNKNOWN_LEVEL # We want to log messages in the form of '[2019-06-04 12:27:14-0500] Something happened...', # so we need to determine the time and append it to the message timestamp = datetime.now(tz=reference.LocalTimezone()).strftime("%Y-%m-%d %I:%M:%S%z") log_message = "[{}] {}".format(timestamp, message) # Log the newly formatted message at the given level logging.getLogger(logger_name).log(level, log_message)
} FIELD_STYLES = { 'levelname': { 'color': 39 }, 'asctime': { 'color': 27 }, 'name': { 'color': 12 }, } NOW = datetime.datetime.now() TIMEZONE = reference.LocalTimezone().tzname(NOW) DATEFMT = '%Y-%m-%d %H:%M:%S {}'.format(TIMEZONE) FMT = '%(name)s %(asctime)s %(levelname)+8s: %(message)s' # disable matplotlib logging logging.getLogger("matplotlib").setLevel(logging.CRITICAL) # -- logging and parsing utilities -------------------------------------------- def logger(name=__name__, level='DEBUG'): """Construct a logger utility for stdout/stderr messages """ logger = logging.getLogger(name) coloredlogs.install(level=level,
import datetime from pytz import reference # Create a new Kafka consumer and ask for the latest set of data being stored in the Kafka bus. # Note that you can use auto_offset_reset='earliest' for ask for all the available data. #consumer = KafkaConsumer(group_id='simple',bootstrap_servers='198.18.134.26:29092', auto_offset_reset='latest') consumer = KafkaConsumer(group_id='simple', bootstrap_servers=IP + ':' + PORT + ' ', auto_offset_reset='latest') # Suscribe to the CDG topic consumer.subscribe([TOPIC]) now = datetime.datetime.now() localtime = reference.LocalTimezone() localtime.tzname(now) ora = now.strftime("%Y-%m-%d %H:%M ") + localtime.tzname(now) logger.info(ora + "\nStart -> Subribed to topic " + TOPIC + "\n") def pretty_print(payload): parsed = json.loads(payload) formatted = json.dumps(parsed, indent=2, sort_keys=True) logger.info( "\n******************************* CDG Message *******************************\n" ) logger.info(formatted)
def get_local_time() -> str: return datetime.now( tz=reference.LocalTimezone()).strftime("%Y-%m-%d at %H:%M:%S %z")
async def on_member_join(self, m): """Japanese Server welcome""" t0 = time.perf_counter() usedInvite = 'none' oldList = self.bot.invitesOld localtime = reference.LocalTimezone() if m.guild == self.bot.jpServ: newList = await self.bot.jpServ.invites() for new in newList: try: # tBef = datetime.now() # test = discord.utils.find(lambda i: i.code == new.code, oldList) # print(test, test.code, test.uses) # if new.uses != test.uses: # tAf = datetime.now() # await self.bot.testChan.send(test) # await self.bot.testChan.send(f'Time to find invite using test method: {tAf-tBef}') old = oldList[oldList.index(new)] # matches the invites if new.uses != old.uses and new.code == old.code: usedInvite = new except ValueError: # if the new invite isn't in old invites if new.uses != 0: usedInvite = new if usedInvite == 'none': newNewList = await self.bot.jpServ.invites() await self.bot.jpEverything.send( f"Yeah, someone joined but I couldn't figure out which invite link they used. " f"Big sorry <:bow2:398262327843225613>. It was {m.name}#{m.discriminator} ({m.id})." ) with open(f'{dir_path}/inviteLog/{m.name}.log', 'w') as file: for i in range(len(newNewList) + 2): try: file.write(f'1) {oldList[i].code}, {oldList[i].uses}\n') file.write(f'2) {newList[i].code}, {newList[i].uses}\n') file.write(f'3) {newNewList[i].code}, {newNewList[i].uses}\n') except IndexError: pass if usedInvite != 'none': minutesAgoCreated = int(((datetime.utcnow() - m.created_at).total_seconds()) // 60) if minutesAgoCreated < 60: timeStr = f'\n\nAccount created **{minutesAgoCreated}** minutes ago' else: timeStr = '' emb = discord.Embed( description=f":inbox_tray: **{m.name}#{m.discriminator}** has `joined` the server. " f"({m.id}){timeStr}", colour=0x7BA600, timestamp=datetime.now(tz=localtime) ) invite_string = f'Used {usedInvite.inviter.name}\'s link {usedInvite.code}' emb.set_footer( text=f'User Join ({self.bot.jpServ.member_count}) {invite_string}', icon_url=m.avatar_url_as(static_format="png") ) # t1 = time.perf_counter() await self.bot.jpEverything.send(embed=emb) # t2 = time.perf_counter() # try: # oldInviteVal = oldList[oldList.index(usedInvite)].uses # newInviteVal = newList[newList.index(usedInvite)].uses # except ValueError: # oldInviteVal = 0 # newInviteVal = newList[newList.index(usedInvite)].uses # await self.bot.testChan.send(content=f'Time to get to before posting embeds: {t1-t0}\n' # f'Time to post embeds: {t2-t1}\n' # f'Member: {m.name} -- ' # f'Invite: {usedInvite.code} -- ' # f'({oldInviteVal}->{newInviteVal})', # embed=emb) japanese_links = ['6DXjBs5', 'WcBF7XZ', 'jzfhS2', 'w6muGjF', 'TxdPsSm', 'MF9XF89', 'RJrcSb3'] if str(usedInvite.code) in japanese_links: await self.bot.jpJHO.send(f'{m.name}さん、サーバーへようこそ!') elif m.id != 414873201349361664: await self.bot.jpJHO.send(f'Welcome {m.name}!') self.bot.invitesOld = newList sys.stderr.flush() sys.stdout.flush() # for i in range(5): # rand = round(random.random(), 3) # # """"Random Walk 1""" # if rand > (0.5 + self.bot.pos1/100): self.bot.pos1 = round(self.bot.pos1+2*rand,3) # else: self.bot.pos1 = round(self.bot.pos1-2*rand,3) # n1 = int(abs(self.bot.pos1))+1 # await self.bot.get_channel(random_walk1).send('-'*n1) # # """Random Walk 2""" # if rand <= 0.35: self.bot.pos2 -= 1 # elif 0.35 < rand < 0.65: pass # elif 0.65 <= rand: self.bot.pos2 += 1 # n2 = abs(self.bot.pos2)+1 # await self.bot.get_channel(random_walk2).send('-'*n2) """Spanish Server welcome""" if m.guild == self.bot.spanServ: nadekoObj = self.bot.spanServ.get_member(116275390695079945) if str(nadekoObj.status) == 'offline': await self.bot.get_channel(243838819743432704).send( 'Welcome to the server. Nadeko is currently down, ' 'so please state your roles and someone in welcoming party will come to' ' assign your role as soon as possible. If no one comes, please tag the mods with `@Mods`. ' 'Thanks! ' '(<@&470364944479813635>)' )