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
c969bf59
Commit
c969bf59
authored
Dec 09, 2021
by
Samy Haffoudhi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ajout du suuport pour channels prives
parent
39edf145
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
4 deletions
+7
-4
app.py
bot/app.py
+7
-4
No files found.
bot/app.py
View file @
c969bf59
...
...
@@ -6,13 +6,16 @@ from slack_sdk.errors import SlackApiError
client
=
WebClient
(
token
=
os
.
environ
.
get
(
"SLACK_BOT_TOKEN"
))
try
:
result
=
client
.
conversations_list
()
result
=
client
.
conversations_list
(
types
=
"public_channel, private_channel"
)
for
response
in
result
:
for
channel
in
result
[
"channels"
]:
if
channel
[
"name"
][
0
]
==
'2'
:
if
not
channel
[
"is_archived"
]:
client
.
conversations_join
(
channel
=
channel
[
"id"
])
if
(
channel
[
"name"
][
0
]
==
'2'
)
and
(
not
channel
[
"is_archived"
]):
try
:
client
.
conversations_join
(
channel
=
channel
[
"id"
])
except
:
pass
client
.
chat_postMessage
(
channel
=
channel
[
"id"
],
text
=
"Salut ! Ceci est un test :grin:"
)
# print(channel["name"])
except
SlackApiError
as
e
:
print
(
f
"Error: {e}"
)
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