making the river function easier to add to
This commit is contained in:
parent
dea0210dd4
commit
3c3a0d7ddb
@ -226,6 +226,14 @@ async def on_message(message):
|
|||||||
)
|
)
|
||||||
|
|
||||||
if message.content.startswith('!invite'):
|
if message.content.startswith('!invite'):
|
||||||
|
# for server in client.servers:
|
||||||
|
# if server.name == 'Alexandria':
|
||||||
|
# for channel in server.channels:
|
||||||
|
# if channel.name == 'cyber_bullying':
|
||||||
|
# invite = await client.create_invite(
|
||||||
|
# destination=channel, max_uses=1, max_age=3600
|
||||||
|
# )
|
||||||
|
# await client.send_message(message.channel, invite)
|
||||||
# 3600 = 1 hour
|
# 3600 = 1 hour
|
||||||
invite = await client.create_invite(
|
invite = await client.create_invite(
|
||||||
destination=message.channel, max_uses=1, max_age=3600
|
destination=message.channel, max_uses=1, max_age=3600
|
||||||
@ -362,7 +370,6 @@ async def on_message(message):
|
|||||||
embed=generate_embed(embed_url=wallpaper.get_wall(message.content))
|
embed=generate_embed(embed_url=wallpaper.get_wall(message.content))
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
if message.content.startswith('!minecraft'):
|
if message.content.startswith('!minecraft'):
|
||||||
# Check permissions
|
# Check permissions
|
||||||
if not role_check.docker_permissions(message.author.roles):
|
if not role_check.docker_permissions(message.author.roles):
|
||||||
|
@ -5,8 +5,8 @@ import threading
|
|||||||
|
|
||||||
results = {}
|
results = {}
|
||||||
|
|
||||||
def get_river_stats(river_url):
|
def get_river_stats(river_id):
|
||||||
url = requests.get(river_url)
|
url = requests.get("https://waterdata.usgs.gov/usa/nwis/uv?" + river_id)
|
||||||
|
|
||||||
soup = BeautifulSoup(url.content, "lxml")
|
soup = BeautifulSoup(url.content, "lxml")
|
||||||
river_name = ' '.join(soup.find('h2').text.split()[2:])
|
river_name = ' '.join(soup.find('h2').text.split()[2:])
|
||||||
@ -19,13 +19,13 @@ def get_river_stats(river_url):
|
|||||||
|
|
||||||
|
|
||||||
def get_stats():
|
def get_stats():
|
||||||
rivers = [
|
river_ids = [
|
||||||
'https://waterdata.usgs.gov/usa/nwis/uv?06752260',
|
'06752260',
|
||||||
'https://waterdata.usgs.gov/co/nwis/uv/?site_no=07091200&PARAmeter_cd=00065,00060',
|
'07091200',
|
||||||
'https://waterdata.usgs.gov/co/nwis/uv/?site_no=06719505&PARAmeter_cd=00065,00060',
|
'06719505',
|
||||||
]
|
]
|
||||||
threads = []
|
threads = []
|
||||||
for river in rivers:
|
for river in river_ids:
|
||||||
t = threading.Thread(target=get_river_stats, args=(river,))
|
t = threading.Thread(target=get_river_stats, args=(river,))
|
||||||
threads.append(t)
|
threads.append(t)
|
||||||
t.start()
|
t.start()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user