Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

5 appunti foss #16

Merged
merged 4 commits into from
Oct 15, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,15 @@ def user_has_role(user: TelegramUser, accepted_roles: set[str], session: Session
return len(roles.intersection(accepted_roles)) > 0


async def reply_repo_appunti(update: Update, context: ContextTypes.DEFAULT_TYPE):
await update.message.reply_html(f"Ciao {update.message.from_user.full_name}, puoi trovare molti appunti gratuiti "
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Forse aggiungerei una menzione completa come facciamo in altre parti del codice

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

non mi è chiarissimo cosa intendi con "menzione completa"

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Giusto, non sono stato preciso. Intendo una menzione non solo con il nome dell'utente, ma anche il fatto che la tagghi; guarda ad esempio la risposta a /help

f"sulla <b>Guida degli Studenti</b>\n\n"
f" » <a href='https://github.com/tsi-unito/guida_degli_studenti_di/tree/master"
f"/Materie'>Appunti</a>",
quote=True,
message_thread_id=update.message.message_thread_id)


# noinspection DuplicatedCode
async def command_activate(update: Update, context: ContextTypes.DEFAULT_TYPE):
message = update.message
Expand Down Expand Up @@ -350,6 +359,7 @@ def main(api_key: str) -> None:
application.add_handler(CommandHandler(["start"], command_start))
application.add_handler(CommandHandler(["rappresentanti", "rapp"], command_rappresentanti))
application.add_handler(CommandHandler(["activate"], command_activate))
application.add_handler(MessageHandler(filters.Regex("(vendo|cerco|compro|avete|qualcuno.*ha|Vendo|Cerco|Compro|Avete|Qualcuno.*ha).*appunti.*"),reply_repo_appunti)) #may be too generic
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sono d'accordo, ma per ora vediamo come va! 😄


application.run_polling()

Expand Down