You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
from .stackoverflowchatsessionimportStackOverflowChatSession
7
-
importconfig
8
-
9
-
importasyncio
2
+
importos
10
3
importjson
11
4
importhtml
5
+
importlogging
12
6
importrandom
13
-
fromqueueimportQueue
7
+
importthreading
8
+
importre
14
9
from .dbmodelimportUser, get_session
10
+
from .sochatimportStackOverflowChatSession, EventType
11
+
12
+
importconfig
15
13
16
14
PYTHON_ROOM_ID=6
17
15
PERSONAL_SANDBOX_ROOM_ID=118024
18
16
ROTATING_KNIVES_ROOM_ID=71097
17
+
AUTHORIZED_USERS= {
18
+
953482, #Kevin
19
+
6621329#Terry
20
+
}
19
21
20
-
#room that all of the bot's actions will occur in.
21
-
#todo: make it possible for the bot to operate simultaneously in multiple rooms. The chat API supports this natively, I just didn't account for it in my design.
22
22
PRIMARY_ROOM_ID=PYTHON_ROOM_ID
23
23
24
-
event_type_names= [
25
-
"placeholder because ids are 1-indexed",
26
-
"message posted",
27
-
"message edited",
28
-
"user entered",
29
-
"user left",
30
-
"room name changed",
31
-
"message starred",
32
-
"UNKNOWN",
33
-
"user mentioned",
34
-
"message flagged",
35
-
"message deleted",
36
-
"file added",
37
-
"moderator flag",
38
-
"user settings chagned",
39
-
"global notification",
40
-
"account level changed",
41
-
"user notification",
42
-
"invitation",
43
-
"message reply",
44
-
"message moved out",
45
-
"message moved in",
46
-
"time break",
47
-
"feed ticker",
48
-
"user suspended",
49
-
"user merged",
50
-
]
24
+
logger=logging.getLogger('rabbit')
51
25
52
26
defabbreviate(msg, maxlen=25):
53
27
iflen(msg) <maxlen: returnmsg
@@ -67,13 +41,11 @@ class Rabbit(StackOverflowChatSession):
67
41
- "kick [user id]" - kicks the user, if bot has RO rights
68
42
- "move [message id,message id,message id]" - moves one or more messages to the Rotating Knives room, if bot has RO rights
0 commit comments