Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
happy-botday
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Guillaume Vagner
happy-botday
Commits
65b29782
Commit
65b29782
authored
6 years ago
by
Guillaume Vagner
Browse files
Options
Downloads
Patches
Plain Diff
remove schedule
parent
8bdd522b
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
schedule.js
+3
-3
3 additions, 3 deletions
schedule.js
telegram.js
+16
-1
16 additions, 1 deletion
telegram.js
with
19 additions
and
4 deletions
schedule.js
+
3
−
3
View file @
65b29782
...
@@ -44,9 +44,9 @@ function addSchedule(chan, time, bot) {
...
@@ -44,9 +44,9 @@ function addSchedule(chan, time, bot) {
};
};
function
deleteSchedule
(
chatId
)
{
function
deleteSchedule
(
chatId
)
{
if
(
schedule
[
chatId
])
{
if
(
schedule
s
[
chatId
])
{
schedule
[
chatId
].
cancel
();
schedule
s
[
chatId
].
cancel
();
delete
(
schedule
[
chatId
]);
delete
(
schedule
s
[
chatId
]);
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
telegram.js
+
16
−
1
View file @
65b29782
...
@@ -6,7 +6,7 @@ var TelegramBot = require('node-telegram-bot-api');
...
@@ -6,7 +6,7 @@ var TelegramBot = require('node-telegram-bot-api');
// Modules propres
// Modules propres
var
{
getChanByChatId
,
createChan
,
deleteChanByChatId
,
modifyChan
,
addGroup
,
getGroups
}
=
require
(
'
./connection-db
'
);
var
{
getChanByChatId
,
createChan
,
deleteChanByChatId
,
modifyChan
,
addGroup
,
getGroups
}
=
require
(
'
./connection-db
'
);
var
{
getBirthdays
,
searchGroups
,
getGroupById
}
=
require
(
'
./requests
'
);
var
{
getBirthdays
,
searchGroups
,
getGroupById
}
=
require
(
'
./requests
'
);
var
{
addSchedule
,
deleteSchedule
}
=
require
(
'
./schedule
'
);
var
{
schedules
,
addSchedule
,
deleteSchedule
}
=
require
(
'
./schedule
'
);
// Configurations
// Configurations
const
config
=
require
(
'
./config
'
);
const
config
=
require
(
'
./config
'
);
...
@@ -180,11 +180,26 @@ bot.onText(/\/schedule (.+)/, (msg, match) => {
...
@@ -180,11 +180,26 @@ bot.onText(/\/schedule (.+)/, (msg, match) => {
bot
.
sendMessage
(
chatId
,
`Votre rappel est configuré pour tous les jours à
${
time
}
`
);
bot
.
sendMessage
(
chatId
,
`Votre rappel est configuré pour tous les jours à
${
time
}
`
);
})
})
bot
.
onText
(
/
\/
unschedule/
,
msg
=>
{
const
chatId
=
msg
.
chat
.
id
;
getChanByChatId
(
chatId
).
then
(
chan
=>
{
if
(
!
chan
)
return
bot
.
sendMessage
(
chatId
,
'
Pas de compte enregistré, faites /start pour commencer
'
);
if
(
chan
.
time
==
''
)
return
bot
.
sendMessage
(
chatId
,
'
Pas de rappel défini...
'
);
deleteSchedule
(
chatId
)
chan
.
time
=
''
return
modifyChan
(
chan
)
}).
then
(
_
=>
{
bot
.
sendMessage
(
chatId
,
'
Votre rappel a été supprimé.
'
)
})
})
// J'étais bien obligé (en vrai c'est pour tester)
// J'étais bien obligé (en vrai c'est pour tester)
bot
.
onText
(
/
\/
nikmarine/
,
msg
=>
{
bot
.
onText
(
/
\/
nikmarine/
,
msg
=>
{
const
chatId
=
msg
.
chat
.
id
;
const
chatId
=
msg
.
chat
.
id
;
bot
.
sendMessage
(
chatId
,
'
Nik bien Marine
'
);
bot
.
sendMessage
(
chatId
,
'
Nik bien Marine
'
);
console
.
log
(
schedules
);
})
})
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment