text stringlengths 0 828 |
|---|
------- |
an :class:`ApiQuery` of :class:`Poll` |
Raises |
------ |
:class:`NotFound` |
If a poll with the requested id doesn't exist. |
"""""" |
@api_query('poll', pollid=str(id)) |
async def result(_, root): |
elem = root.find('POLL') |
if not elem: |
raise NotFound(f'No poll found with id {id}') |
return Poll(elem) |
return result(self)" |
4280,"def banner(self, *ids, _expand_macros=None): |
""""""Get data about banners by their ids. |
Macros in banners' names and descriptions are not expanded. |
Parameters |
---------- |
*ids : str |
Banner ids. |
Returns |
------- |
an :class:`ApiQuery` of a list of :class:`Banner` |
Raises |
------ |
:class:`NotFound` |
If any of the provided ids is invalid. |
"""""" |
async def noop(s): |
return s |
_expand_macros = _expand_macros or noop |
@api_query('banner', banner=','.join(ids)) |
async def result(_, root): |
banners = [await Banner(elem, _expand_macros) |
for elem in root.find('BANNERS')] |
if not len(banners) == len(ids): |
raise NotFound('one of the banner ids provided is invalid') |
return banners |
return result(self)" |
4281,"async def send_telegram(self, *, client_key, telegram_id, |
telegram_key, recepient): |
""""""A basic interface to the Telegrams API. |
Parameters |
---------- |
client_key : str |
Telegrams API Client Key. |
telegram_id : int or str |
Telegram id. |
telegram_key : str |
Telegram key. |
recepient : str |
Name of the nation you want to telegram. |
Returns |
------- |
an awaitable |
"""""" |
params = { |
'a': 'sendTG', |
'client': client_key, |
'tgid': str(telegram_id), |
'key': telegram_key, |
'to': recepient |
} |
return await self._call_api(params)" |
4282,"async def happenings(self, *, nations=None, regions=None, filters=None, |
beforeid=None, beforetime=None): |
""""""Iterate through happenings from newest to oldest. |
Parameters |
---------- |
nations : iterable of str |
Nations happenings of which will be requested. Cannot be |
specified at the same time with ``regions``. |
regions : iterable of str |
Regions happenings of which will be requested. Cannot be |
specified at the same time with ``nations``. |
filters : iterable of str |
Categories to request happenings by. Available filters |
are: ``law``, ``change``, ``dispatch``, ``rmb``, |
``embassy``, ``eject``, ``admin``, ``move``, ``founding``, |
``cte``, ``vote``, ``resolution``, ``member``, and ``endo``. |
beforeid : int |
Only request happenings before this id. |
beforetime : :class:`datetime.datetime` |
Only request happenings that were emitted before this |
moment. |
Returns |
------- |
an asynchronous iterator yielding any of the classes from \ |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.