summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCoprDistGit <infra@openeuler.org>2023-05-05 15:16:13 +0000
committerCoprDistGit <infra@openeuler.org>2023-05-05 15:16:13 +0000
commit827aa48d552cacc8fb8267f670068596701bdac9 (patch)
treebd3b725f64ca4928511c6727beac633e9498af3e
parent215255f74ae46c55eb03795a0dcb97929f685ddb (diff)
automatic import of python-aiocordopeneuler20.03
-rw-r--r--.gitignore1
-rw-r--r--python-aiocord.spec579
-rw-r--r--sources1
3 files changed, 581 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index e69de29..a8a5d7e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1 @@
+/aiocord-1.1.10.tar.gz
diff --git a/python-aiocord.spec b/python-aiocord.spec
new file mode 100644
index 0000000..d4edefd
--- /dev/null
+++ b/python-aiocord.spec
@@ -0,0 +1,579 @@
+%global _empty_manifest_terminate_build 0
+Name: python-aiocord
+Version: 1.1.10
+Release: 1
+Summary: API wrapper for Discord.
+License: MIT
+URL: https://github.com/Exahilosys/aiocord
+Source0: https://mirrors.nju.edu.cn/pypi/web/packages/eb/53/8bd4d520c1054a7fdd41cea211c622d044ee30f74559712b3c066e5e4794/aiocord-1.1.10.tar.gz
+BuildArch: noarch
+
+Requires: python3-aiohttp
+Requires: python3-yarl
+Requires: python3-pynacl
+
+%description
+# Installing
+```
+python3 -m pip install aiocord
+```
+# Simple Usage
+```py
+import asyncio
+import aiohttp
+import aiocord.engine # external
+
+token = 'APPLICATION_TOKEN'
+
+# get the event loop
+loop = asyncio.get_event_loop()
+
+# create a session
+session = aiohttp.ClientSession(loop = loop)
+
+# cooperative client
+client = aiocord.engine.Client(session, token, loop = loop)
+
+@client.track('ready')
+async def handle_0(shard, version, initial_guild_ids):
+
+ # caution! blocking
+ print(shard, 'ready')
+
+@client.track('message create')
+async def handle_1(shard, guild, channel, message):
+
+ signal = '.say '
+
+ if message.content.startswith(signal):
+
+ response = message.content[len(signal):]
+
+ await client.create_message(channel.id, content = response)
+
+async def initialize():
+
+ await client.start()
+
+async def finalize():
+
+ await client.close()
+
+ await session.close()
+
+try:
+
+ loop.run_until_complete(initialize())
+
+ try:
+
+ loop.run_forever()
+
+ except KeyboardInterrupt:
+
+ pass
+
+finally:
+
+ loop.run_until_complete(finalize())
+```
+# Advanced Usage
+```py
+import asyncio
+import aiohttp
+import aiocord
+import functools
+
+token = 'APPLICATION_TOKEN'
+
+# get the event loop
+loop = asyncio.get_event_loop()
+
+# create a session
+session = aiohttp.ClientSession(loop = loop)
+
+# used for fetching info
+rest = aiocord.rest.Client(session, loop = loop)
+
+# authorize
+rest.authorize(token)
+
+# this is our stream handler
+def handle(shard, event, data):
+
+ # caution! blocking
+ print(shard, event)
+
+ if event == 'READY':
+
+ session_id = data['session_id']
+
+ # needed for resume
+ shard.patch(session_id)
+
+ return
+
+shards = []
+
+async def initialize():
+
+ # sharding information
+ data = await rest.get_gateway_bot()
+
+ # shard count and gateway url
+ count, url = data['shards'], data['url']
+
+ # index is the shard id
+ for index in range(count):
+
+ # needed for identify
+ info = (index, count)
+
+ # used for listening to events
+ gateway = aiocord.gateway.Client(session, token, info, loop = loop)
+
+ # docs advice to routinely update the response of the
+ # get gateway bot request, hence why this method exists
+ gateway.update(url)
+
+ # pass the current gateway to our handler
+ callback = functools.partial(handle, gateway)
+
+ # will be called with
+ # every event dispatch
+ gateway.track(callback)
+
+ # connect, start event steam
+ # and identify with info given
+ await gateway.start()
+
+ shards.append(gateway)
+
+ if not index < count:
+
+ break
+
+ await asyncio.sleep(5.5)
+
+async def finalize():
+
+ for gateway in shards:
+
+ await gateway.close()
+
+ await session.close()
+
+try:
+
+ loop.run_until_complete(initialize())
+
+ try:
+
+ loop.run_forever()
+
+ except KeyboardInterrupt:
+
+ pass
+
+finally:
+
+ loop.run_until_complete(finalize())
+```
+
+
+
+
+%package -n python3-aiocord
+Summary: API wrapper for Discord.
+Provides: python-aiocord
+BuildRequires: python3-devel
+BuildRequires: python3-setuptools
+BuildRequires: python3-pip
+%description -n python3-aiocord
+# Installing
+```
+python3 -m pip install aiocord
+```
+# Simple Usage
+```py
+import asyncio
+import aiohttp
+import aiocord.engine # external
+
+token = 'APPLICATION_TOKEN'
+
+# get the event loop
+loop = asyncio.get_event_loop()
+
+# create a session
+session = aiohttp.ClientSession(loop = loop)
+
+# cooperative client
+client = aiocord.engine.Client(session, token, loop = loop)
+
+@client.track('ready')
+async def handle_0(shard, version, initial_guild_ids):
+
+ # caution! blocking
+ print(shard, 'ready')
+
+@client.track('message create')
+async def handle_1(shard, guild, channel, message):
+
+ signal = '.say '
+
+ if message.content.startswith(signal):
+
+ response = message.content[len(signal):]
+
+ await client.create_message(channel.id, content = response)
+
+async def initialize():
+
+ await client.start()
+
+async def finalize():
+
+ await client.close()
+
+ await session.close()
+
+try:
+
+ loop.run_until_complete(initialize())
+
+ try:
+
+ loop.run_forever()
+
+ except KeyboardInterrupt:
+
+ pass
+
+finally:
+
+ loop.run_until_complete(finalize())
+```
+# Advanced Usage
+```py
+import asyncio
+import aiohttp
+import aiocord
+import functools
+
+token = 'APPLICATION_TOKEN'
+
+# get the event loop
+loop = asyncio.get_event_loop()
+
+# create a session
+session = aiohttp.ClientSession(loop = loop)
+
+# used for fetching info
+rest = aiocord.rest.Client(session, loop = loop)
+
+# authorize
+rest.authorize(token)
+
+# this is our stream handler
+def handle(shard, event, data):
+
+ # caution! blocking
+ print(shard, event)
+
+ if event == 'READY':
+
+ session_id = data['session_id']
+
+ # needed for resume
+ shard.patch(session_id)
+
+ return
+
+shards = []
+
+async def initialize():
+
+ # sharding information
+ data = await rest.get_gateway_bot()
+
+ # shard count and gateway url
+ count, url = data['shards'], data['url']
+
+ # index is the shard id
+ for index in range(count):
+
+ # needed for identify
+ info = (index, count)
+
+ # used for listening to events
+ gateway = aiocord.gateway.Client(session, token, info, loop = loop)
+
+ # docs advice to routinely update the response of the
+ # get gateway bot request, hence why this method exists
+ gateway.update(url)
+
+ # pass the current gateway to our handler
+ callback = functools.partial(handle, gateway)
+
+ # will be called with
+ # every event dispatch
+ gateway.track(callback)
+
+ # connect, start event steam
+ # and identify with info given
+ await gateway.start()
+
+ shards.append(gateway)
+
+ if not index < count:
+
+ break
+
+ await asyncio.sleep(5.5)
+
+async def finalize():
+
+ for gateway in shards:
+
+ await gateway.close()
+
+ await session.close()
+
+try:
+
+ loop.run_until_complete(initialize())
+
+ try:
+
+ loop.run_forever()
+
+ except KeyboardInterrupt:
+
+ pass
+
+finally:
+
+ loop.run_until_complete(finalize())
+```
+
+
+
+
+%package help
+Summary: Development documents and examples for aiocord
+Provides: python3-aiocord-doc
+%description help
+# Installing
+```
+python3 -m pip install aiocord
+```
+# Simple Usage
+```py
+import asyncio
+import aiohttp
+import aiocord.engine # external
+
+token = 'APPLICATION_TOKEN'
+
+# get the event loop
+loop = asyncio.get_event_loop()
+
+# create a session
+session = aiohttp.ClientSession(loop = loop)
+
+# cooperative client
+client = aiocord.engine.Client(session, token, loop = loop)
+
+@client.track('ready')
+async def handle_0(shard, version, initial_guild_ids):
+
+ # caution! blocking
+ print(shard, 'ready')
+
+@client.track('message create')
+async def handle_1(shard, guild, channel, message):
+
+ signal = '.say '
+
+ if message.content.startswith(signal):
+
+ response = message.content[len(signal):]
+
+ await client.create_message(channel.id, content = response)
+
+async def initialize():
+
+ await client.start()
+
+async def finalize():
+
+ await client.close()
+
+ await session.close()
+
+try:
+
+ loop.run_until_complete(initialize())
+
+ try:
+
+ loop.run_forever()
+
+ except KeyboardInterrupt:
+
+ pass
+
+finally:
+
+ loop.run_until_complete(finalize())
+```
+# Advanced Usage
+```py
+import asyncio
+import aiohttp
+import aiocord
+import functools
+
+token = 'APPLICATION_TOKEN'
+
+# get the event loop
+loop = asyncio.get_event_loop()
+
+# create a session
+session = aiohttp.ClientSession(loop = loop)
+
+# used for fetching info
+rest = aiocord.rest.Client(session, loop = loop)
+
+# authorize
+rest.authorize(token)
+
+# this is our stream handler
+def handle(shard, event, data):
+
+ # caution! blocking
+ print(shard, event)
+
+ if event == 'READY':
+
+ session_id = data['session_id']
+
+ # needed for resume
+ shard.patch(session_id)
+
+ return
+
+shards = []
+
+async def initialize():
+
+ # sharding information
+ data = await rest.get_gateway_bot()
+
+ # shard count and gateway url
+ count, url = data['shards'], data['url']
+
+ # index is the shard id
+ for index in range(count):
+
+ # needed for identify
+ info = (index, count)
+
+ # used for listening to events
+ gateway = aiocord.gateway.Client(session, token, info, loop = loop)
+
+ # docs advice to routinely update the response of the
+ # get gateway bot request, hence why this method exists
+ gateway.update(url)
+
+ # pass the current gateway to our handler
+ callback = functools.partial(handle, gateway)
+
+ # will be called with
+ # every event dispatch
+ gateway.track(callback)
+
+ # connect, start event steam
+ # and identify with info given
+ await gateway.start()
+
+ shards.append(gateway)
+
+ if not index < count:
+
+ break
+
+ await asyncio.sleep(5.5)
+
+async def finalize():
+
+ for gateway in shards:
+
+ await gateway.close()
+
+ await session.close()
+
+try:
+
+ loop.run_until_complete(initialize())
+
+ try:
+
+ loop.run_forever()
+
+ except KeyboardInterrupt:
+
+ pass
+
+finally:
+
+ loop.run_until_complete(finalize())
+```
+
+
+
+
+%prep
+%autosetup -n aiocord-1.1.10
+
+%build
+%py3_build
+
+%install
+%py3_install
+install -d -m755 %{buildroot}/%{_pkgdocdir}
+if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi
+if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi
+if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi
+if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi
+pushd %{buildroot}
+if [ -d usr/lib ]; then
+ find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+if [ -d usr/lib64 ]; then
+ find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+if [ -d usr/bin ]; then
+ find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+if [ -d usr/sbin ]; then
+ find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+touch doclist.lst
+if [ -d usr/share/man ]; then
+ find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst
+fi
+popd
+mv %{buildroot}/filelist.lst .
+mv %{buildroot}/doclist.lst .
+
+%files -n python3-aiocord -f filelist.lst
+%dir %{python3_sitelib}/*
+
+%files help -f doclist.lst
+%{_docdir}/*
+
+%changelog
+* Fri May 05 2023 Python_Bot <Python_Bot@openeuler.org> - 1.1.10-1
+- Package Spec generated
diff --git a/sources b/sources
new file mode 100644
index 0000000..ac70339
--- /dev/null
+++ b/sources
@@ -0,0 +1 @@
+95af5e1296aee526a11d691772e0a03e aiocord-1.1.10.tar.gz