Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
campus_bot
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
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Ferdinand Schober
campus_bot
Commits
fea64e3d
Commit
fea64e3d
authored
Dec 21, 2020
by
Ferdinand Schober
Browse files
Options
Downloads
Patches
Plain Diff
fix some log messages
parent
867f4327
Branches
android-goldfish-3.18-dev
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
discord_hook.py
+10
-6
10 additions, 6 deletions
discord_hook.py
main.py
+1
-2
1 addition, 2 deletions
main.py
with
11 additions
and
8 deletions
discord_hook.py
+
10
−
6
View file @
fea64e3d
...
...
@@ -4,7 +4,7 @@ import json
import
time
from
pprint
import
pprint
from
contextlib
import
ExitStack
from
log
import
print_info
,
print_error
,
color
,
BOLD
,
ITALIC
,
WHITE
,
CLEAR
from
log
import
print_info
,
print_error
,
print_warn
,
color
,
BOLD
,
ITALIC
,
WHITE
,
CLEAR
webhook_url
=
None
...
...
@@ -96,20 +96,24 @@ def validate_webhook_url(webhook_url):
try
:
r
=
requests
.
get
(
webhook_url
)
r
.
raise_for_status
()
except
Exception
as
e
:
print_warn
(
'
Invalid webhook:
'
+
str
(
e
))
return
False
try
:
json
=
r
.
json
()
except
Exception
as
e
:
print_error
(
'
Invalid webhook:
'
)
print
(
e
)
print_warn
(
'
Invalid webhook: Expected a json response
'
)
return
False
name
=
json
.
get
(
'
name
'
)
if
not
name
:
print_error
(
"
Invalid webhook!
Could not
find a name
associated with the bot.
"
)
"
Invalid webhook!
Expected to
find a name
"
)
exit
(
1
)
s
=
input
(
f
'
use webhook
"
{
color
(
ITALIC
,
WHITE
)
}{
json
.
get
(
"
name
"
)
}{
CLEAR
}
"
? [Y,n]
'
)
f
'
found webhook
"
{
color
(
ITALIC
,
WHITE
)
}{
json
.
get
(
"
name
"
)
}{
CLEAR
}
"
,
'
'
is this correct? [Y,n]
'
)
if
s
==
'
y
'
or
s
==
'
Y
'
or
not
s
:
return
True
return
False
...
...
This diff is collapsed.
Click to expand it.
main.py
+
1
−
2
View file @
fea64e3d
...
...
@@ -10,7 +10,7 @@ import sys
import
campus
import
discord_hook
from
log
import
print_info
from
log
import
print_info
,
print_warn
close_requested
=
False
...
...
@@ -27,7 +27,6 @@ def main():
with
campus
.
Connection
(
args
.
u
)
as
connection
:
with
discord_hook
.
Connection
()
as
discord_connection
:
print_info
(
'
online
'
)
global
online
online
=
True
discord_connection
.
send
(
'
[status] online
'
)
...
...
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