Compare commits
2 Commits
c011383f0e
...
task_manag
Author | SHA1 | Date | |
---|---|---|---|
|
97d613df58 | ||
|
1e56a84a4c |
@@ -5,7 +5,7 @@ def processmsg(msg, rcpt):
|
|||||||
if "youtube.com/watch" in msg:
|
if "youtube.com/watch" in msg:
|
||||||
return msg.replace("youtube.com", "iv.datura.network")
|
return msg.replace("youtube.com", "iv.datura.network")
|
||||||
elif msg.startswith("!"):
|
elif msg.startswith("!"):
|
||||||
return command(msg)
|
return command(msg, "")
|
||||||
elif "good bot" in msg:
|
elif "good bot" in msg:
|
||||||
return "^_^"
|
return "^_^"
|
||||||
|
|
||||||
@@ -23,4 +23,7 @@ def command(msg, rcpt):
|
|||||||
elif msg.startswith("!wiki"):
|
elif msg.startswith("!wiki"):
|
||||||
cmd, query = msg.split(" ", 1)
|
cmd, query = msg.split(" ", 1)
|
||||||
return sf.query_external_website("https://en.wikipedia.org", "/wiki/" + query)
|
return sf.query_external_website("https://en.wikipedia.org", "/wiki/" + query)
|
||||||
|
elif msg.startswith("!tasks"):
|
||||||
|
content = sf.getDmzTasks()
|
||||||
|
return content
|
||||||
|
|
||||||
|
@@ -17,3 +17,17 @@ def query_external_website(base_url, query):
|
|||||||
return "\nTITLE:\n" + title + "\n\nCONTENT:\n" + content.text + "\n\nFULL LINK:\n" + base_url + quote(query)
|
return "\nTITLE:\n" + title + "\n\nCONTENT:\n" + content.text + "\n\nFULL LINK:\n" + base_url + quote(query)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
return e
|
return e
|
||||||
|
|
||||||
|
def getDmzTasks():
|
||||||
|
try:
|
||||||
|
page = requests.get("https://todo.dmz.rs/")
|
||||||
|
soup = BeautifulSoup(page.content, "html.parser")
|
||||||
|
tasks = soup.find_all(class_="task")
|
||||||
|
result = "\nActive tasks:\n"
|
||||||
|
for task in tasks:
|
||||||
|
taskIndex = task.select("div")[0].text
|
||||||
|
taskTitle = task.select("div")[1].text
|
||||||
|
result += taskIndex + " " + taskTitle + "\n"
|
||||||
|
return result
|
||||||
|
except Exception as e:
|
||||||
|
return e
|
||||||
|
Reference in New Issue
Block a user