This repository was archived by the owner on Jun 20, 2024. It is now read-only.
File tree 5 files changed +15
-16
lines changed
5 files changed +15
-16
lines changed Original file line number Diff line number Diff line change 11
11
12
12
from . import const , exc , util
13
13
14
- __version__ : typing .Final [str ] = "1.3 .0"
14
+ __version__ : typing .Final [str ] = "2.0 .0"
15
15
16
16
17
17
class Awc :
Original file line number Diff line number Diff line change @@ -182,7 +182,7 @@ def applied(awc: Awc) -> bool:
182
182
return util .resp_to_bool (awc .get (api = "applied" ).text )
183
183
184
184
185
- def anon (awc : Awc , content : str ) -> requests . Response :
185
+ def anon (awc : Awc , content : str ) -> str :
186
186
"""send message to server anonymously
187
187
188
188
awc: awc.Awc -- the awc.Awc instance to work on
@@ -195,4 +195,4 @@ def anon(awc: Awc, content: str) -> requests.Response:
195
195
data = {
196
196
"content" : util .truncate (content , const .MAX_CONTENT_LEN ),
197
197
},
198
- )
198
+ ). text
Original file line number Diff line number Diff line change @@ -145,6 +145,7 @@ class AnonMsg(SQLTable):
145
145
146
146
cid : pypika .Column = t .cid # type: ignore
147
147
content : pypika .Column = t .content # type: ignore
148
+ headers : pypika .Column = t .headers # type: ignore
148
149
149
150
150
151
def sql (query : pypika .queries .QueryBuilder ) -> str :
Original file line number Diff line number Diff line change @@ -102,19 +102,19 @@ def censor_comments(
102
102
]
103
103
104
104
105
- def get_anon_msg (cid : int ) -> typing .List [pypika .queries .QueryBuilder ]:
105
+ def get_anon_msg (ip : str ) -> typing .List [pypika .queries .QueryBuilder ]:
106
106
"""get an anonymous message by id
107
107
108
- cid: int -- content id
108
+ ip: str -- content id ( ip )
109
109
110
110
return typing.List[pypika.queries.QueryBuilder] -- the queries"""
111
- return [AnonMsg .select (AnonMsg .cid == cid , AnonMsg .content )] # type: ignore
111
+ return [AnonMsg .select (AnonMsg .cid == ip , AnonMsg .content )] # type: ignore
112
112
113
113
114
- def del_anon_msg (cid : int ) -> typing .List [pypika .queries .QueryBuilder ]:
114
+ def del_anon_msg (ip : str ) -> typing .List [pypika .queries .QueryBuilder ]:
115
115
"""delete an anonymous message by id
116
116
117
- cid: int -- content id
117
+ ip: str -- content id ( ip )
118
118
119
119
return typing.List[pypika.queries.QueryBuilder] -- the queries"""
120
- return [delete (AnonMsg .query (AnonMsg .cid == cid ))] # type: ignore
120
+ return [delete (AnonMsg .query (AnonMsg .cid == ip ))] # type: ignore
Original file line number Diff line number Diff line change @@ -132,17 +132,15 @@ def main() -> int:
132
132
print ("whoami api returned" , (author := awc .api .whoami (api )))
133
133
134
134
print (
135
- "anon message with id " ,
136
- ( anon_id := int ( awc .api .anon (api , infinput ("anonymous message" )). text )),
135
+ "anon api returned " ,
136
+ awc .api .anon (api , infinput ("anonymous message" )),
137
137
)
138
138
139
- print (
140
- "anon msg :" ,
141
- awc .api .sql (api , awc .sql .multisql (awc .sql .helpers .get_anon_msg (anon_id ))),
142
- )
139
+ print ("anon msgs" )
140
+ print (awc .api .sql (api , "SELECT * FROM anon;" ))
143
141
144
142
print ("deleting the anon msg" )
145
- print (awc .api .sql (api , awc . sql . multisql ( awc . sql . helpers . del_anon_msg ( anon_id )) ))
143
+ print (awc .api .sql (api , "DELETE FROM anon;" ))
146
144
147
145
print ("imma ban you wait" )
148
146
print (awc .api .sql (api , awc .sql .multisql (awc .sql .helpers .ban (author ))))
You can’t perform that action at this time.
0 commit comments