issue #1 and small fixes
This commit is contained in:
1 parent
a8779696b6
commit
1cff89cf71
4 files changed
+47
-9
No files matched your search
@@ -0,0 +1,24 @@
|
||||
import pytz
|
||||
import datetime as dt
|
||||
|
||||
def possible_timezones(tz_offset, common_only=True):
|
||||
# pick one of the timezone collections
|
||||
timezones = pytz.common_timezones if common_only else pytz.all_timezones
|
||||
|
||||
# convert the float hours offset to a timedelta
|
||||
offset_days, offset_seconds = 0, int(tz_offset * 3600)
|
||||
if offset_seconds < 0:
|
||||
offset_days = -1
|
||||
offset_seconds += 24 * 3600
|
||||
desired_delta = dt.timedelta(offset_days, offset_seconds)
|
||||
|
||||
# Loop through the timezones and find any with matching offsets
|
||||
null_delta = dt.timedelta(0, 0)
|
||||
results = []
|
||||
for tz_name in timezones:
|
||||
tz = pytz.timezone(tz_name)
|
||||
non_dst_offset = getattr(tz, '_transition_info', [[null_delta]])[-1]
|
||||
if desired_delta == non_dst_offset[0]:
|
||||
results.append(tz_name)
|
||||
|
||||
return results
|
||||
+5
-4
@@ -10,12 +10,13 @@ async def embed_list_paginated(bot, pre, items, item_fct, base_embed, footer_pre
|
||||
|
||||
# footer text
|
||||
#footer_text = f'Type {pre}show <label> to show a poll. '
|
||||
footer_text = footer_prefix
|
||||
if start > 0:
|
||||
footer_prefix += f'React with ⏪ to show the last {per_page} entries. '
|
||||
footer_text += f'React with ⏪ to show the last {per_page} entries. '
|
||||
if items.__len__() > start+per_page:
|
||||
footer_prefix += f'React with ⏩ to show the next {per_page} entries. '
|
||||
if footer_prefix.__len__() > 0:
|
||||
embed.set_footer(text=footer_prefix)
|
||||
footer_text += f'React with ⏩ to show the next {per_page} entries. '
|
||||
if footer_text.__len__() > 0:
|
||||
embed.set_footer(text=footer_text)
|
||||
|
||||
# post / edit message
|
||||
if msg is not None:
|
||||
|
||||
Reference in new issue
Block a user