Commit 91e45f67 authored by Tanguy's avatar Tanguy

Merge branch 'master' of git.centralenantesetudes.fr:shaffoudhi/projet-i2

J'ai besoin de pull pour push !
parents 04ac3f68 bd573bd8
SLACK_TOKEN=xoxb-17091197537-2808341799910-Rt1jxyQ7BTZ9HU7TmtYBqY1m export SLACK_BOT_TOKEN=xoxb-17091197537-2808341799910-Rt1jxyQ7BTZ9HU7TmtYBqY1m
export SLACK_SIGNING_SECRET=bde8ff61717e3e84be1e9b21f159a1d7
import os
from slack_bolt import App
app = App(
token=os.environ.get("SLACK_BOT_TOKEN"),
signing_secret=os.environ.get("SLACK_SIGNING_SECRET")
)
@app.event("app_home_opened")
def update_home_tab(client, event, logger):
try:
# views.publish is the method that your app uses to push a view to the Home tab
client.views_publish(
# the user that opened your app's app home
user_id=event["user"],
# the view object that appears in the app home
view={
"type": "home",
"callback_id": "home_view",
# body of the view
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "*Bienvenue sur l'app du projet i2* :tada:"
}
},
{
"type": "divider"
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "Bouton totalement inutile ci-dessous."
}
},
{
"type": "actions",
"elements": [
{
"type": "button",
"text": {
"type": "plain_text",
"text": "Clique quand même !"
}
}
]
}
]
}
)
except Exception as e:
logger.error(f"Error publishing home tab: {e}")
if __name__ == "__main__":
app.start(port=int(os.environ.get("PORT", 3000)))
import slack
import os
from pathlib import Path
from dotenv import load_dotenv
env_path = Path('.') / '.env'
load_dotenv(dotenv_path=env_path)
client = slack.WebClient(token=os.environ['SLACK_TOKEN'])
client.chat_postMessage(channel='#3_proj_i2', text="Salut!")
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment