Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
P
projet i2
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Samy Haffoudhi
projet i2
Commits
bd573bd8
Commit
bd573bd8
authored
Dec 08, 2021
by
Samy Haffoudhi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
code exemple bolt
parent
bb42b780
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
62 additions
and
0 deletions
+62
-0
app.py
bot/app.py
+62
-0
No files found.
bot/app.py
0 → 100644
View file @
bd573bd8
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
)))
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment