Compare commits
13 Commits
8b58615dc3
...
d9a1bbf10f
Author | SHA1 | Date |
---|---|---|
b3yond | d9a1bbf10f | |
b3yond | 8f21e7d134 | |
b3yond | 81f32e0898 | |
b3yond | fc0ffca1f7 | |
b3yond | c8bf3e1fba | |
b3yond | 3ed458b518 | |
b3yond | 2df0b1317e | |
b3yond | ce15776077 | |
Enno G | 5bb5f9f05b | |
SchoolGuy | 06d5568a03 | |
b3yond | adea5004f4 | |
b3yond | 013643bc78 | |
b3yond | 22488d3aa6 |
11
README.md
11
README.md
|
@ -152,10 +152,19 @@ echo "Enter your domain name into the following prompt:" && read DOMAIN
|
|||
# configure nginx
|
||||
sudo sed -r "s/example.org/$DOMAIN/g" deployment/example.org.conf > /etc/nginx/sites-enabled/$DOMAIN.conf
|
||||
|
||||
# create folder for socket & database
|
||||
# create folder for database
|
||||
sudo mkdir /var/ticketfrei
|
||||
sudo chown www-data:www-data -R /var/ticketfrei
|
||||
|
||||
# create folder for socket
|
||||
sudo mkdir /var/run/ticketfrei
|
||||
sudo chown -R www-data:www-data /var/run/ticketfrei
|
||||
sudo -s
|
||||
echo "mkdir /var/run/ticketfrei" >> /etc/rc.local
|
||||
echo "chown -R www-data:www-data /var/run/ticketfrei" >> /etc/rc.local
|
||||
echo "service ticketfrei-web restart" >> /etc/rc.local
|
||||
exit
|
||||
|
||||
# change /etc/aliases permissions to be able to receive reports per mail
|
||||
sudo chown root:www-data /etc/aliases
|
||||
sudo chmod 664 /etc/aliases
|
||||
|
|
|
@ -21,12 +21,24 @@ class MastodonBot(Bot):
|
|||
try:
|
||||
m = mastodon.Mastodon(*user.get_masto_credentials())
|
||||
except TypeError:
|
||||
# logger.error("No Mastodon Credentials in database.", exc_info=True)
|
||||
# No Mastodon Credentials in database.
|
||||
return mentions
|
||||
try:
|
||||
notifications = m.notifications()
|
||||
except mastodon.MastodonInternalServerError:
|
||||
logger.error("Mastodon Error: 500. Server: " + m.instance()['urls']['streaming_api'])
|
||||
return mentions
|
||||
except mastodon.MastodonBadGatewayError:
|
||||
logger.error("Mastodon Error: 502. Server: " + m.instance()['urls']['streaming_api'])
|
||||
return mentions
|
||||
except mastodon.MastodonServiceUnavailableError:
|
||||
logger.error("Mastodon Error: 503. Server: " + m.instance()['urls']['streaming_api'])
|
||||
return mentions
|
||||
except mastodon.MastodonGatewayTimeoutError:
|
||||
logger.error("Mastodon Error: 504. Server: " + m.instance()['urls']['streaming_api'])
|
||||
return mentions
|
||||
except mastodon.MastodonServerError:
|
||||
logger.error("Unknown Mastodon API Error: 502")
|
||||
logger.error("Unknown Mastodon Server Error. Server: " + m.instance()['urls']['streaming_api'], exc_info=True)
|
||||
return mentions
|
||||
for status in notifications:
|
||||
if (status['type'] == 'mention' and
|
||||
|
|
|
@ -23,6 +23,7 @@ class TelegramBot(Bot):
|
|||
# return when telegram returns an error code
|
||||
if update in [303, 404, 420, 500, 502]:
|
||||
return reports
|
||||
# log unusual telegram error messages
|
||||
if isinstance(update, int):
|
||||
try:
|
||||
logger.error("City " + str(user.uid) +
|
||||
|
@ -31,13 +32,22 @@ class TelegramBot(Bot):
|
|||
except TypeError:
|
||||
logger.error("Unknown Telegram error code: " + str(update))
|
||||
return reports
|
||||
# save the last message, so it doesn't get crawled again
|
||||
user.save_seen_tg(update.update_id)
|
||||
# complain if message is a photo
|
||||
if update.message.photo:
|
||||
tb.send_message(
|
||||
update.message.sender.id,
|
||||
"Sending Photos is not supported for privacy reasons. Can "
|
||||
"you describe it as text instead?")
|
||||
continue
|
||||
# complain if message is a media file
|
||||
if update.message.text is None:
|
||||
tb.send_message(
|
||||
update.message.sender.id,
|
||||
"We only support text reporting for privacy reasons. Can "
|
||||
"you describe it as text instead?")
|
||||
continue
|
||||
if update.message.text.lower() == "/start":
|
||||
user.add_telegram_subscribers(update.message.sender.id)
|
||||
tb.send_message(
|
||||
|
|
Loading…
Reference in New Issue