Fakultas Ilmu Komputer UI
Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
ZAKI RAIHAN
1606878505_ossd_telegram_notif_bot
Commits
8f652f6e
Commit
8f652f6e
authored
Oct 04, 2019
by
zakiraihan
Browse files
Adjust styling and activate notif
parent
1efc3aeb
Changes
7
Hide whitespace changes
Inline
Side-by-side
app.py
View file @
8f652f6e
...
...
@@ -45,8 +45,23 @@ def set_webhook():
def
hello
():
return
"Hello World!"
@
app
.
route
(
'/sendNotification'
,
methods
=
[
'POST'
])
def
sendNotif
():
@
app
.
route
(
'/sendNotification/custom'
,
methods
=
[
'POST'
])
def
sendNotifCustom
():
from
models.AccountModel
import
AccountModel
req_data
=
request
.
get_json
()
user
=
AccountModel
.
query
.
filter
(
AccountModel
.
ssoId
==
req_data
[
'username'
]).
first
()
if
(
user
is
None
):
return
{
'status'
:
404
,
'message'
:
'User not found'
}
elif
(
user
.
chatId
==
None
):
return
{
'status'
:
500
,
'message'
:
'User notification is being turned off'
}
else
:
param
=
urllib
.
parse
.
urlencode
({
'chat_id'
:
user
.
chatId
,
'text'
:
req_data
[
'message'
]})
url
=
"https://api.telegram.org/bot"
+
TOKEN
+
"/sendMessage?"
+
param
r
=
requests
.
get
(
url
=
url
)
return
r
.
json
()
@
app
.
route
(
'/sendNotification/sisurat'
,
methods
=
[
'POST'
])
def
sendNotifSisurat
():
from
models.AccountModel
import
AccountModel
req_data
=
request
.
get_json
()
user
=
AccountModel
.
query
.
filter
(
AccountModel
.
ssoId
==
req_data
[
'username'
]).
first
()
...
...
static/css/default.css
0 → 100644
View file @
8f652f6e
.makeSureBox
{
width
:
400px
;
max-width
:
400px
;
display
:
inline-block
;
border
:
2px
solid
#000
;
border-radius
:
10px
;
overflow
:
hidden
;
margin-top
:
30px
;
}
.boxTitle
{
padding-top
:
15px
;
color
:
white
;
background-color
:
#5c94bd
;
border-bottom
:
2px
solid
#000
;
}
.ssoContent
{
padding-right
:
23px
;
padding-left
:
23px
;
}
.ssoBtn
{
margin-bottom
:
15px
;
border-radius
:
10px
;
background-color
:
#5c94bd
;
border-color
:
#5c94bd
;
}
.ssoLoginBtn
{
margin-bottom
:
15px
;
border-radius
:
10px
;
}
\ No newline at end of file
telebot/mastermind.py
View file @
8f652f6e
...
...
@@ -34,6 +34,8 @@ def save_user_notif_activation_data(bot, chat_id, contact):
bot
.
sendMessage
(
chat_id
=
chat_id
,
text
=
"You are not logged in yet"
,
reply_markup
=
ReplyKeyboardRemove
())
else
:
checkAccountExistance
.
chatId
=
chat_id
checkAccountExistance
.
firstName
=
contact
.
first_name
checkAccountExistance
.
lastName
=
contact
.
last_name
checkAccountExistance
.
update
()
bot
.
sendMessage
(
chat_id
=
chat_id
,
text
=
"Register success!!!"
,
reply_markup
=
ReplyKeyboardRemove
())
...
...
telebot/sisuratNotif.py
0 → 100644
View file @
8f652f6e
templates/authPhoneNumber.html
View file @
8f652f6e
...
...
@@ -8,37 +8,12 @@
<title>
Login Fasilkom Telegram Bot
</title>
<link
rel=
"stylesheet"
href=
"https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"
integrity=
"sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T"
crossorigin=
"anonymous"
>
<link
rel=
"stylesheet"
type=
"text/css"
href=
"https://sso.ui.ac.id/cas/themes/ui/sso.css"
/>
<link
rel=
"stylesheet"
type=
"text/css"
href=
"{{ url_for('static', filename='css/default.css') }}"
>
<link
rel=
"icon"
href=
"https://sso.ui.ac.id/cas/themes/ui/logo2_0.gif"
type=
"image/x-icon"
/>
<style>
.makeSureBox
{
width
:
400px
;
max-width
:
400px
;
display
:
inline-block
;
border
:
2px
solid
#000
;
border-radius
:
10px
;
overflow
:
hidden
;
}
.boxTitle
{
padding-top
:
15px
;
color
:
white
;
background-color
:
#5c94bd
;
border-bottom
:
2px
solid
#000
;
}
.ssoContent
{
padding-right
:
23px
;
padding-left
:
23px
;
}
.ssoBtn
{
margin-bottom
:
15px
;
border-radius
:
10px
;
background-color
:
#5c94bd
;
border-color
:
#5c94bd
;
}
</style>
</head>
<body>
<div
class=
"container d-flex
align-items-center
justify-content-center
min-vh-100
"
>
<div
class=
"container d-flex justify-content-center"
>
<div
class=
"makeSureBox"
>
<div
class=
"row d-flex justify-content-center boxTitle"
>
<h5
style=
"text-align:center;"
>
Fasilkom Telegram Bot Notification
</h5>
...
...
templates/failedToLoginSSO.html
View file @
8f652f6e
...
...
@@ -8,48 +8,25 @@
<title>
Login Fasilkom Telegram Bot
</title>
<link
rel=
"stylesheet"
href=
"https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"
integrity=
"sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T"
crossorigin=
"anonymous"
>
<link
rel=
"stylesheet"
type=
"text/css"
href=
"https://sso.ui.ac.id/cas/themes/ui/sso.css"
/>
<link
rel=
"stylesheet"
type=
"text/css"
href=
"{{ url_for('static', filename='css/default.css') }}"
>
<link
rel=
"icon"
href=
"https://sso.ui.ac.id/cas/themes/ui/logo2_0.gif"
type=
"image/x-icon"
/>
<style>
.makeSureBox
{
width
:
250px
;
max-width
:
250px
;
display
:
inline-block
;
border
:
2px
solid
#000
;
border-radius
:
10px
;
overflow
:
hidden
;
}
.boxTitle
{
padding-top
:
15px
;
color
:
white
;
background-color
:
#5c94bd
;
border-bottom
:
2px
solid
#000
;
}
.ssoMsg
{
padding-right
:
23px
;
padding-left
:
23px
;
}
.ssoBtn
{
margin-bottom
:
15px
;
border-radius
:
10px
;
}
</style>
</head>
<body>
<div
class=
"container d-flex
align-items-center
justify-content-center
min-vh-100
"
>
<div
class=
"container d-flex justify-content-center"
>
<div
class=
"makeSureBox"
>
<div
class=
"row d-flex justify-content-center boxTitle"
>
<h5
style=
"text-align:center;"
>
Fasilkom Telegram Bot Notification
</h5>
</div>
<div
style=
'clear:both'
></div>
<br>
<div
class=
"row sso
Msg
"
>
<div
class=
"row sso
Content
"
>
<p
style=
"text-align:justify;"
>
Mohon maaf proses authentifikasi gagal dikarenakan kesalahan username atau password, silahkan coba kembali dengan menekan tombol dibawah ini.
</p>
</div>
<div
class=
"row d-flex justify-content-center align-items-center"
>
<a
href=
"/loginsso"
class=
"btn btn-warning ssoBtn"
role=
"button"
>
Login SSO
</a>
<a
href=
"/loginsso"
class=
"btn btn-warning sso
Login
Btn"
role=
"button"
>
Login SSO
</a>
</div>
</div>
</div>
...
...
templates/successToLoginSSO.html
View file @
8f652f6e
...
...
@@ -8,37 +8,12 @@
<title>
Login Fasilkom Telegram Bot
</title>
<link
rel=
"stylesheet"
href=
"https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"
integrity=
"sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T"
crossorigin=
"anonymous"
>
<link
rel=
"stylesheet"
type=
"text/css"
href=
"https://sso.ui.ac.id/cas/themes/ui/sso.css"
/>
<link
rel=
"stylesheet"
type=
"text/css"
href=
"{{ url_for('static', filename='css/default.css') }}"
>
<link
rel=
"icon"
href=
"https://sso.ui.ac.id/cas/themes/ui/logo2_0.gif"
type=
"image/x-icon"
/>
<style>
.makeSureBox
{
width
:
400px
;
max-width
:
400px
;
display
:
inline-block
;
border
:
2px
solid
#000
;
border-radius
:
10px
;
overflow
:
hidden
;
}
.boxTitle
{
padding-top
:
15px
;
color
:
white
;
background-color
:
#5c94bd
;
border-bottom
:
2px
solid
#000
;
}
.ssoContent
{
padding-right
:
23px
;
padding-left
:
23px
;
}
.ssoBtn
{
margin-bottom
:
15px
;
border-radius
:
10px
;
background-color
:
#5c94bd
;
border-color
:
#5c94bd
;
}
</style>
</head>
<body>
<div
class=
"container d-flex
align-items-center
justify-content-center
min-vh-100
"
>
<div
class=
"container d-flex justify-content-center"
>
<div
class=
"makeSureBox"
>
<div
class=
"row d-flex justify-content-center boxTitle"
>
<h5
style=
"text-align:center;"
>
Fasilkom Telegram Bot Notification
</h5>
...
...
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