master
Tuan 3 years ago
commit f0cdc80ccf
  1. 8
      .gitignore
  2. 10
      README.md
  3. 11
      cal.py
  4. 7
      cal.sh
  5. 0
      cal.txt
  6. 0
      kafe
  7. 11
      kafeterya.py
  8. 9
      kafeterya.sh

8
.gitignore vendored

@ -0,0 +1,8 @@
# See https://help.github.com/articles/ignoring-files for more about ignoring files.
#
# If you find yourself ignoring temporary files generated by your text editor
# or operating system, you probably want to add a global ignore instead:
# git config --global core.excludesfile '~/.gitignore_global'
# Bot harici dosyalari gormezden gel
cacheclear.sh

@ -0,0 +1,10 @@
# metu.life #
Bu depo, [metu.life](https://metu.life) botlarının kaynak kodlarını barındırır.
+ [kafeterya\_bot@metu.life](https://metu.life/@kafeterya_bot)
- kafeterya.sh menüyü kafe.txt dosyasına yazar
- kafeterya.py içeriği platformda paylaşır
+ [akademik_bot@metu.life](https://metu.life/@akademik_bot)
- cal.sh takvim kesitini cal.txt dosyasına yazar
- cal.py içeriği platformda paylaşır

@ -0,0 +1,11 @@
from mastodon import Mastodon
mastodon = Mastodon(
access_token = 'top-secret',
api_base_url = 'https://metu.life/'
)
file = open("cal.txt", "r")
calendar = file.read()
if len(calendar) > 15:
mastodon.status_post(calendar)

@ -0,0 +1,7 @@
#!/bin/bash
if [[ $(date +%u) -gt 5 ]]; then
range=7
else
range=3
fi
calcurse -Q --days $range | sed 's/*/+/g' > cal.txt && python3 cal.py

@ -0,0 +1,11 @@
from mastodon import Mastodon
mastodon = Mastodon(
access_token = 'top-secret',
api_base_url = 'https://metu.life/'
)
file = open("kafe.txt", "r")
yemek = file.read()
if len(yemek) > 8:
mastodon.status_post(yemek)

@ -0,0 +1,9 @@
#!/bin/bash
url='https://kafeterya.metu.edu.tr/'
outfile='kafe.txt'
echo "Günün yemeği:" > ${outfile}
curl -s ${url} | /snap/bin/xmllint --html --xpath '//div[@class="yemek"]/p' --format - | sed -e 's/<[^>]*>//g' -e '/*/d' -e 's/^/+ /g' -e 's/./\L&/g4' >> ${outfile}
python3 kafeterya.py
Loading…
Cancel
Save