Merge branch 'flows' into 'master'
making the river function easier to add to See merge request ldooks/dragon-bot!1
This commit is contained in:
commit
aacb7335bf
@ -226,6 +226,14 @@ async def on_message(message):
|
||||
)
|
||||
|
||||
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
|
||||
invite = await client.create_invite(
|
||||
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))
|
||||
)
|
||||
|
||||
|
||||
if message.content.startswith('!minecraft'):
|
||||
# Check permissions
|
||||
if not role_check.docker_permissions(message.author.roles):
|
||||
|
@ -5,8 +5,8 @@ import threading
|
||||
|
||||
results = {}
|
||||
|
||||
def get_river_stats(river_url):
|
||||
url = requests.get(river_url)
|
||||
def get_river_stats(river_id):
|
||||
url = requests.get("https://waterdata.usgs.gov/usa/nwis/uv?" + river_id)
|
||||
|
||||
soup = BeautifulSoup(url.content, "lxml")
|
||||
river_name = ' '.join(soup.find('h2').text.split()[2:])
|
||||
@ -19,13 +19,13 @@ def get_river_stats(river_url):
|
||||
|
||||
|
||||
def get_stats():
|
||||
rivers = [
|
||||
'https://waterdata.usgs.gov/usa/nwis/uv?06752260',
|
||||
'https://waterdata.usgs.gov/co/nwis/uv/?site_no=07091200&PARAmeter_cd=00065,00060',
|
||||
'https://waterdata.usgs.gov/co/nwis/uv/?site_no=06719505&PARAmeter_cd=00065,00060',
|
||||
river_ids = [
|
||||
'06752260',
|
||||
'07091200',
|
||||
'06719505',
|
||||
]
|
||||
threads = []
|
||||
for river in rivers:
|
||||
for river in river_ids:
|
||||
t = threading.Thread(target=get_river_stats, args=(river,))
|
||||
threads.append(t)
|
||||
t.start()
|
||||
|
Loading…
x
Reference in New Issue
Block a user