Page Menu
Home
Phabricator (Chris)
Search
Configure Global Search
Log In
Files
F627304
group_utilities.py
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None
group_utilities.py
View Options
def
read_lines
(
filename
):
lines
=
[]
try
:
with
open
(
filename
,
'r'
)
as
f
:
for
line
in
f
:
lines
.
append
(
line
[:
-
1
])
except
IOError
:
print
'Failed to open {}'
.
format
(
filename
)
return
lines
def
logger
(
logtype
,
msg
,
edited
,
reply
,
command
):
try
:
senderusername
=
"{} ({})"
.
format
(
msg
[
'from'
][
'id'
],
msg
[
'from'
][
'username'
])
except
:
senderusername
=
"No Username"
if
msg
[
'chat'
][
'type'
]
==
'private'
:
chattitle
=
"Private Message with {}"
.
format
(
senderusername
)
else
:
chattitle
=
msg
[
'chat'
][
'title'
]
if
logtype
==
'hendrik'
:
print
"HENDRIK:
\n
Message Text: {}
\n
Sender: {}
\n
Chat: {}
\n
Edited: {}
\n
"
.
format
(
msg
[
'text'
],
senderusername
,
chattitle
,
edited
)
if
logtype
==
'command'
:
print
"COMMAND:
\n
Command: {}
\n
Message Text: {}
\n
Sender: {}
\n
Chat: {}
\n
Reply: {}
\n
"
.
format
(
command
,
msg
[
'text'
],
senderusername
,
chattitle
,
reply
)
if
logtype
==
'cooldown'
:
print
"COOLDOWN:
\n
Message Text: {}
\n
Sender: {}
\n
Chat: {}
\n
Time Elapsed: {}
\n
"
.
format
(
msg
[
'text'
],
senderusername
,
chattitle
,
reply
)
if
logtype
==
'blacklist'
:
print
"BLACKLIST:
\n
Message Text: {}
\n
Sender: {}
\n
Chat: {}
\n
"
.
format
(
msg
[
'text'
],
senderusername
,
chattitle
)
File Metadata
Details
Attached
Mime Type
text/x-script.python
Expires
Sun, Nov 15, 1:52 AM (1 d, 1 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
138738
Default Alt Text
group_utilities.py (1 KB)
Attached To
Mode
R41 JanBot
Attached
Detach File
Event Timeline