Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
accounting
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
Administrator
accounting
Commits
e2ec4a50
Commit
e2ec4a50
authored
Jun 21, 2019
by
Ahmad Nemati
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
init
parent
a7c831c1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
17 deletions
+7
-17
app.js
app.js
+7
-17
No files found.
app.js
View file @
e2ec4a50
...
...
@@ -11,22 +11,16 @@ const TelegramBot = require('node-telegram-bot-api');
const
token
=
process
.
env
.
DEBUG
===
'
true
'
?
process
.
env
.
LOCAL_TOKEN
:
process
.
env
.
SERVER_TOKEN
;
cron
.
schedule
(
'
*/15 * * * *
'
,
()
=>
{
runCron
()
runCron
()
});
const
bot
=
new
TelegramBot
(
token
,
{
polling
:
true
});
runCron
()
bot
.
on
(
'
message
'
,
(
msg
)
=>
{
console
.
log
(
msg
)
processMessage
(
msg
)
...
...
@@ -164,7 +158,7 @@ async function showCount(msg, unit) {
let
admin
=
await
db
.
findAdmin
(
msg
)
admin
.
data
=
JSON
.
parse
(
admin
.
data
)
let
type
=
admin
.
data
.
action
// console.log(admin.data)
// console.log(admin.data)
admin
.
data
.
vahed
=
unit
await
db
.
updateData
(
msg
,
JSON
.
stringify
(
admin
.
data
))
...
...
@@ -355,7 +349,7 @@ async function reportRequest(msg, date) {
break
}
let
reqs
=
await
db
.
getRequestByDate
(
msg
.
data
,
date
)
// console.log(reqs)
// console.log(reqs)
message
.
deleteMessage
(
bot
,
msg
)
message
.
listRequest
(
bot
,
msg
,
reqs
)
}
...
...
@@ -373,8 +367,8 @@ async function generateText(current, num, msg) {
async
function
runCron
()
{
let
admins
=
await
db
.
getAllAdmins
()
let
name
=
'
./back/
'
+
'
backup-
'
+
moment
().
format
(
'
YYYY-MM-DD---HH-mm
'
)
+
'
.sql
'
let
name
=
'
./back/
'
+
'
backup-
'
+
moment
().
format
(
'
YYYY-MM-DD---HH-mm
'
)
+
'
.sql
'
const
result
=
await
mysqldump
({
connection
:
{
host
:
'
195.201.22.255
'
,
...
...
@@ -383,11 +377,7 @@ async function runCron() {
database
:
'
accounting
'
,
},
dumpToFile
:
name
,
});
for
(
let
i
=
0
;
i
<
admins
.
length
;
i
++
)
{
bot
.
sendDocument
(
admins
[
i
].
teleid
,
name
)
}
bot
.
sendDocument
(
'
-1001392333493
'
,
name
)
}
...
...
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