Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Guillaume Vagner
happy-botday
Commits
3e95b671
Commit
3e95b671
authored
Feb 23, 2019
by
Guillaume Vagner
Browse files
retroactive schedule
parent
59745434
Changes
1
Hide whitespace changes
Inline
Side-by-side
schedule.js
View file @
3e95b671
...
...
@@ -13,14 +13,14 @@ function addSchedule(chan, time, bot) {
const
hour
=
parseInt
(
time
.
split
(
'
:
'
)[
0
]);
const
minute
=
parseInt
(
time
.
split
(
'
:
'
)[
1
]);
chan
.
schedule
=
time
;
return
Promise
.
all
([
modifyChan
(
chan
),
getGroups
(
chan
.
chatId
)
]).
then
(([
chan
,
groups
])
=>
{
return
modifyChan
(
chan
).
then
(
chan
=>
{
schedules
[
chan
.
chatId
]
=
schedule
.
scheduleJob
({
hour
:
hour
,
minute
:
minute
},
function
()
{
return
getNewToken
(
chan
).
then
(
chan
=>
{
return
getBirthdays
(
chan
.
token
)
}).
then
(
users
=>
{
return
Promise
.
all
([
getBirthdays
(
chan
.
token
),
getGroups
(
chan
.
chatId
)
])
}).
then
(([
users
,
groups
])
=>
{
// récupère que les personnes du jour qui font partie des groupes ciblés
const
newUsers
=
users
.
filter
(
user
=>
user
.
asso
.
some
(
asso
=>
groups
.
indexOf
(
asso
)
!==
-
1
));
if
(
newUsers
.
length
===
0
)
return
...
...
Write
Preview
Supports
Markdown
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