Skip to content

Commit 6bf8269

Browse files
committed
Added return of phrase id on creation
1 parent d5de79a commit 6bf8269

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

IreneAPIWrapper/models/banphrase.py

+11-2
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ async def insert(
105105
phrase,
106106
punishment,
107107
log_channel_id
108-
) -> None:
108+
) -> int:
109109
r"""
110110
Insert a new BanPhrase into the database and cache.
111111
@@ -120,7 +120,8 @@ async def insert(
120120
log_channel_id: int
121121
Channel to send log messages to
122122
123-
:returns: None
123+
:returns: int
124+
Phrase ID
124125
"""
125126
callback = await internal_insert(
126127
request={
@@ -133,6 +134,14 @@ async def insert(
133134
}
134135
)
135136

137+
results = callback.response.get("results")
138+
if not results:
139+
return False
140+
141+
phrase_id = results["addbanphrase"]
142+
await BanPhrase.fetch(phrase_id) # add object to cache.
143+
144+
136145
@staticmethod
137146
async def get(phrase_id: int, fetch=True):
138147
"""Get a BanPhrase object.

0 commit comments

Comments
 (0)