🚀 An asynchronous python API wrapper meant to replace discord.py - Snappy discord api wrapper written with aiohttp & websockets

Overview

Pincer Logo Pincer

Scrutinizer Code Quality Build Status GitHub repo size GitHub last commit GitHub commit activity GitHub Code Style Discord

An asynchronous python API wrapper meant to replace discord.py

The package is currently within the planning phase

📌 Links

Pincer Logo |Join the discord server: https://discord.gg/8WkYz3fNFm
Pincer Logo |The pypi package: https://pypi.org/project/Pincer
Pincer Logo |Our website: https://pincer.dev

☄️ Installation

Use the following command to install Pincer into your python environment:

pip install pincer
⚙️ Didn't work?

Depending on your python installation, you might need to use one of the following:

  • pip isn't in the path but python is

    python -m pip install pincer
  • Unix system can use pip3/python3 command

    pip3 install pincer
    python3 -m pip install pincer
  • python isn't in the path

    path/to/python.exe -m pip install pincer
  • Using multiple python versions

    py -m pip install pincer

Current Features

  • Dispatcher
  • Logging Improved
  • HTTP Client
  • Client base class
  • Basic events Improved

Client base class example:

from pincer.client import Bot

# Note that both `Bot` and `Client` are valid!
bot = Bot("...")
bot.run()

An example on on_ready event

from time import perf_counter
from pincer.client import Client

client = Client("...")


@client.event
async def on_ready():
    print(f"Logged in as {client.bot} after {perf_counter()} seconds")


client.run()

Inherited client

You have the possibility to use your own class to inherit from the pincer bot base.

class Bot(Client):

    def __init__(self) -> None:
        super(Bot, self).__init__(token='...')

    @Client.event
    async def on_ready(self) -> None:
        ...

See an advanced bot implementation:

https://github.com/Pincer-org/Pincer

Enable the debug mode

If you want to see everything that is happening under the hood, either for curiosity or the implementation of some features, we provide a debug logging!

import logging

logging.basicConfig(level=logging.DEBUG)

Note: A lot of printing can happen, with sensitive information, make sure to be aware or what your doing if your enable it!

🏷️ License

© 2021 copyright Pincer

This repository is licensed under the MIT License.

See LICENSE for details.

Comments
  • ⚡Flash | Aiohttp SpeedUp

    ⚡Flash | Aiohttp SpeedUp

    Changes

    • adds: Aiohttp Speedup

    Check off the following

    • [x] I have tested my changes with the current requirements
    • [x] My Code follows the pep8 code style.
    enhancement 
    opened by VincentRPS 13
  • ✨Type checking imports for all type hints

    ✨Type checking imports for all type hints

    Task

    Only import type hints when TYPE_CHECKING is true.

    Must be present:

    from __future__ import annotations
    
    from typing import TYPE_CHECKING
    

    Example

    from __future__ import annotations
    
    from typing import TYPE_CHECKING
    from dataclasses import dataclass
    
    
    if TYPE_CHECKING:
        from typing import List
    
    
    @dataclass
    class Foo:
        bar: List[int] = None
    
    enhancement easy 
    opened by Arthurdw 12
  • 📝 Upgrade docs

    📝 Upgrade docs

    Changes

    • adds: More docstrings
    • fixed: closes #86 and closes #83
    • improvements: Better numpy docstrings with the RestructuredText also changed

    Check off the following

    • [x] I have tested my changes with the current requirements
    • [x] My Code follows the pep8 code style.

    Linted and fixed with autopep8 and flake8, line endings are all LF.

    https://pincer-upgraded-docs.rtfd.io

    documentation enhancement Hacktoberfest 
    opened by ooliver1 11
  • 🔨 Implement command options (subcommands)

    🔨 Implement command options (subcommands)

    Feature

    Implement subcommands. So that eg the following data gets sent to discord:

    {
        "name": "permissions",
        "description": "Get or edit permissions for a user or a role",
        "options": [
            {
                "name": "user",
                "description": "Get or edit permissions for a user",
                "type": 2, // 2 is type SUB_COMMAND_GROUP
                "options": [
                    {
                        "name": "get",
                        "description": "Get permissions for a user",
                        "type": 1, // 1 is type SUB_COMMAND
                        "options": [
                            {
                                "name": "user",
                                "description": "The user to get",
                                "type": 6, // 6 is type USER
                                "required": true
                            },
                            {
                                "name": "channel",
                                "description": "The channel permissions to get. If omitted, the guild permissions will be returned",
                                "type": 7, // 7 is type CHANNEL
                                "required": false
                            }
                        ]
                    },
                    {
                        "name": "edit",
                        "description": "Edit permissions for a user",
                        "type": 1,
                        "options": [
                            {
                                "name": "user",
                                "description": "The user to edit",
                                "type": 6,
                                "required": true
                            },
                            {
                                "name": "channel",
                                "description": "The channel permissions to edit. If omitted, the guild permissions will be edited",
                                "type": 7,
                                "required": false
                            }
                        ]
                    }
                ]
            },
            {
                "name": "role",
                "description": "Get or edit permissions for a role",
                "type": 2,
                "options": [
                    {
                        "name": "get",
                        "description": "Get permissions for a role",
                        "type": 1,
                        "options": [
                            {
                                "name": "role",
                                "description": "The role to get",
                                "type": 8, // 8 is type ROLE
                                "required": true
                            },
                            {
                                "name": "channel",
                                "description": "The channel permissions to get. If omitted, the guild permissions will be returned",
                                "type": 7,
                                "required": false
                            }
                        ]
                    },
                    {
                        "name": "edit",
                        "description": "Edit permissions for a role",
                        "type": 1,
                        "options": [
                            {
                                "name": "role",
                                "description": "The role to edit",
                                "type": 8,
                                "required": true
                            },
                            {
                                "name": "channel",
                                "description": "The channel permissions to edit. If omitted, the guild permissions will be edited",
                                "type": 7,
                                "required": false
                            }
                        ]
                    }
                ]
            }
        ]
    }
    

    Code implementation

    Open for discussion, please post suggestions on how you'd like to use this in the lib.

    Useful link(s)

    https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-option-structure

    enhancement 
    opened by Arthurdw 11
  • Proper Shutdown Capabilitiy

    Proper Shutdown Capabilitiy

    Is your feature request related to a problem? Please describe.

    I think pincer needs actual shut-down logic. Something like this on Client:

    def run(self):
        loop = asyncio.get_event_loop()
        self.stop_event = asyncio.Event(loop=loop)
        loop.run_until_complete(self._run())
        loop.run_until_complete(self.stop_event.wait())
        loop.run_until_complete(self._cleanup())
    
    async def _run(self):
        await self.start_shard(0, 1)
    
    async def _cleanup(self):
        if self.session and not self.session.closed:
            await self.session.close()
    
        # self.http is cleaned up be __del__ ???
    
    def stop(self):
        """Tells the bot to shutdown"""
    
        self.stop_event.set()
    

    Describe the solution you would like

    Magic

    Describe alternatives you have considered

    There is no alternative to magic

    Additional context

    magic

    enhancement 
    opened by CircuitSacul 9
  • Audio

    Audio

    Voice Transmitting Based And Some Code Taken From discord.py Voice Recording Based Off The Following:

    https://github.com/Rapptz/discord.py/pull/6507 https://github.com/nextcord/nextcord/pull/224

    Changes

    • adds: Opus Voice Support
    • adds: #217
    • removes: Bin In gitignore

    Check off the following

    • [ ] I have tested my changes with the current requirements
    • [x] My Code follows the pep8 code style.
    enhancement help wanted 
    opened by VincentRPS 9
  • :sparkles: Middleware addition

    :sparkles: Middleware addition

    Changes

    • adds:
      • on_channel_delete
      • on_channel_pins_update
      • on_channel_update
      • on_guild_delete
      • on_guild_update
      • on_message_reaction_add
      • on_message_reaction_remove
      • on_message_reaction_remove_all
      • on_message_reaction_remove_emoji
      • on_thread_create
      • on_thread_delete
      • on_thread_list_sync
      • on_thread_member_update
      • on_thread_members_update
      • on_thread_update

    Check off the following

    • [x] I have tested my changes with the current requirements
    • [x] My Code follows the pep8 code style.
    enhancement 
    opened by Endercheif 9
  • :children_crossing: new example with PIL

    :children_crossing: new example with PIL

    Changes

    • adds: tweet_generator.py example

    Check off the following

    • [X] I have tested my changes with the current requirements
    • [X] My Code follows the pep8 code style.
    enhancement 
    opened by drawbu 8
  • Nox stuff

    Nox stuff

    Changes

    It has come to my attention that many of the measure we have in place are not being run or used as much. Nox will fix that. Before doing a pr, on can run nox on their local machine to run tests and lints. As a workflow, they will also run.

    Check off the following

    • [x] I have tested my changes with the current requirements
    • [x] My Code follows the pep8 code style.
    CI 
    opened by Endercheif 7
  • :sparkles: Rewrote command registration and added cogs

    :sparkles: Rewrote command registration and added cogs

    Changes

    • adds: Cogs. Look at the cog example to see how it works. Also kills old cog system.
    • fixed: Commands and Message Components are registered when a class is initiated. This makes pincer a lot more modular and any class can register a cog now. as long as it inherits from Interactable ~~FUNCTIONAL BOTS WILL BE IMPOSSIBLE IF THIS GETS MERGED.~~ Rewrote and they're possible + better
    • improvements: ...

    Check off the following

    • [x] I have tested my changes with the current requirements
    • [x] My Code follows the pep8 code style.
    opened by Lunarmagpie 7
  • ✨ Add more guild methods

    ✨ Add more guild methods

    Changes

    • adds: the remaining stuff for #222

    Check off the following

    • [x] I have tested my changes with the current requirements
    • [x] My Code follows the pep8 code style.
    enhancement 
    opened by Endercheif 7
Releases(0.16.1)
  • 0.16.1(Aug 9, 2022)

    What's Changed

    • ♻️ reorganised imports by @Kylianalex in https://github.com/Pincer-org/Pincer/pull/436
    • :sparkles: Added an imager welcome example by @Arthurdw in https://github.com/Pincer-org/Pincer/pull/453
    • :construction_worker: Updated package to use Poetry by @Endercheif in https://github.com/Pincer-org/Pincer/pull/468
    • :art: Formatting with black once and for all by @Sigmanificient in https://github.com/Pincer-org/Pincer/pull/473
    • Nox stuff by @Endercheif in https://github.com/Pincer-org/Pincer/pull/469
    • :bug: command can now accept Optional[T] as a type by @ooliver1 in https://github.com/Pincer-org/Pincer/pull/480
    • ✨ Partially implement MODAL_SUBMIT by @Sly-Little-Fox in https://github.com/Pincer-org/Pincer/pull/485

    Full Changelog: https://github.com/Pincer-org/Pincer/compare/0.16.0...0.16.1

    Source code(tar.gz)
    Source code(zip)
  • 0.16.0(Mar 2, 2022)

    What's Changed

    • :sparkles: Random fixes by @Sigmanificient in https://github.com/Pincer-org/Pincer/pull/373
    • ✨ Adding close, is_closed and saving loop by @Sigmanificient in https://github.com/Pincer-org/Pincer/pull/371
    • :construction_worker: Add a license generator by @beastmatser in https://github.com/Pincer-org/Pincer/pull/381
    • :bug: Fix sticker description by @Sigmanificient in https://github.com/Pincer-org/Pincer/pull/383
    • :construction_worker: Fix license generator by @beastmatser in https://github.com/Pincer-org/Pincer/pull/385
    • :ambulance: fix empty __all__'s by @VincentRPS in https://github.com/Pincer-org/Pincer/pull/386
    • :sparkles: Add support for Annotated type hint for command arguments and deprecate CommandArg by @Lunarmagpie in https://github.com/Pincer-org/Pincer/pull/379
    • :sparkles: Adding message history by @Sigmanificient in https://github.com/Pincer-org/Pincer/pull/380
    • :sparkles: Add permission handler by @beastmatser in https://github.com/Pincer-org/Pincer/pull/378
    • :sparkles: added get_shard method to client by @Lunarmagpie in https://github.com/Pincer-org/Pincer/pull/384
    • :sparkles: Get Invite & Delete invite by @Sigmanificient in https://github.com/Pincer-org/Pincer/pull/393
    • :bug: Fix emotes & guild Features by @Sigmanificient in https://github.com/Pincer-org/Pincer/pull/401
    • :sparkles: Add guild sheduled event endpoints by @beastmatser in https://github.com/Pincer-org/Pincer/pull/396
    • ♻️ Using a Custom class for Generator to be awaitable by @Sigmanificient in https://github.com/Pincer-org/Pincer/pull/403
    • :pencil: Fixed typo in VoiceChannel and NewsChannel by @Kylianalex in https://github.com/Pincer-org/Pincer/pull/417
    • :bug: Fixed api endpoint for guild member role actions by @Kylianalex in https://github.com/Pincer-org/Pincer/pull/426
    • :sparkles: Allow for GuildMember in kick & ban by @Skelmis in https://github.com/Pincer-org/Pincer/pull/422
    • :sparkles: Add ENABLED_DISCOVERABLE_BEFORE feature by @Dr-Electron in https://github.com/Pincer-org/Pincer/pull/431
    • :sparkles: Rewrote command registration and added cogs by @Lunarmagpie in https://github.com/Pincer-org/Pincer/pull/389
    • :memo: Docs improvements by @Kylianalex in https://github.com/Pincer-org/Pincer/pull/434
    • :sparkles: Crosspost Method by @Endercheif in https://github.com/Pincer-org/Pincer/pull/432
    • :sparkles: Added StageInstance Methods by @Endercheif in https://github.com/Pincer-org/Pincer/pull/433

    New Contributors

    • @sourcery-ai made their first contribution in https://github.com/Pincer-org/Pincer/pull/388
    • @Skelmis made their first contribution in https://github.com/Pincer-org/Pincer/pull/422
    • @Dr-Electron made their first contribution in https://github.com/Pincer-org/Pincer/pull/431

    Full Changelog: https://github.com/Pincer-org/Pincer/compare/0.15.3...0.16.0

    Source code(tar.gz)
    Source code(zip)
  • 0.15.3(Jan 10, 2022)

    What's Changed

    • 🔥 Removing construct_client_dict by Fixing APIObject client attribute by @Sigmanificient in https://github.com/Pincer-org/Pincer/pull/360
    • :bug: fixed bugs with APIObject by @Lunarmagpie in https://github.com/Pincer-org/Pincer/pull/363
    • ✨ Adding approx member count by @Sigmanificient in https://github.com/Pincer-org/Pincer/pull/364
    • ✨ Adding support for THREAD_ENABLED guild Feature by @Sigmanificient in https://github.com/Pincer-org/Pincer/pull/367
    • :arrow_up: update aiohttp to ~=3.8 by @Lunarmagpie in https://github.com/Pincer-org/Pincer/pull/368

    Full Changelog: https://github.com/Pincer-org/Pincer/compare/0.15.2...0.15.3

    Source code(tar.gz)
    Source code(zip)
  • 0.15.2(Jan 8, 2022)

    What's Changed

    • :sparkles: Command groups by @Lunarmagpie in https://github.com/Pincer-org/Pincer/pull/342
    • :bug: Make sort-alls work on all branches by @Lunarmagpie in https://github.com/Pincer-org/Pincer/pull/355
    • :bug: gateway no longer starts multiple instances by @Lunarmagpie in https://github.com/Pincer-org/Pincer/pull/354

    Full Changelog: https://github.com/Pincer-org/Pincer/compare/0.15.1...0.15.2

    Source code(tar.gz)
    Source code(zip)
  • 0.15.1(Jan 6, 2022)

    What's Changed

    • :sparkles: Adding Interaction Flag support for list to message by @Sigmanificient in https://github.com/Pincer-org/Pincer/pull/346
    • :bug: Fix MessageUpdate event causing crash by @Lunarmagpie in https://github.com/Pincer-org/Pincer/pull/344
    • ♻️ Added query params parameter to HTTP get requests by @DarviL82 in https://github.com/Pincer-org/Pincer/pull/343
    • :sparkles: Adding Pillow Images support for list to message by @drawbu in https://github.com/Pincer-org/Pincer/pull/351
    • :bug: fix GuildFeatures not existing by @Lunarmagpie in https://github.com/Pincer-org/Pincer/pull/352
    • :wrench: Added more info to CONTRIBUTING.md and add issue forms by @Endercheif in https://github.com/Pincer-org/Pincer/pull/349
    • :recycle: small improvements by @Sigmanificient in https://github.com/Pincer-org/Pincer/pull/347

    Full Changelog: https://github.com/Pincer-org/Pincer/compare/0.15.0...0.15.1

    Source code(tar.gz)
    Source code(zip)
  • 0.15.0(Jan 2, 2022)

    What's Changed

    • :pencil: Added mermaid support to docs by @Lunarmagpie in https://github.com/Pincer-org/Pincer/pull/313
    • :sparkles: Adding ScheduleEvent by @Sigmanificient in https://github.com/Pincer-org/Pincer/pull/304
    • :sparkles: Added Channel.bulk_delete_messages() and Channel.edit_permissions() by @DarviL82 in https://github.com/Pincer-org/Pincer/pull/316
    • :tada: Added all user and current user methods by @Endercheif in https://github.com/Pincer-org/Pincer/pull/299
    • :sparkles: Added 10 endpoints to Channel by @DarviL82 in https://github.com/Pincer-org/Pincer/pull/320
    • :sparkles: Moved InviteMetadata to Invite by @Kylianalex in https://github.com/Pincer-org/Pincer/pull/319
    • :bug: Fixed command registration and closes #256 by @Lunarmagpie in https://github.com/Pincer-org/Pincer/pull/317
    • :sparkles: Added UserMessage.from_id by @Endercheif in https://github.com/Pincer-org/Pincer/pull/315
    • :arrow_up: Adding Python 3.10 as supported by @VincentRPS in https://github.com/Pincer-org/Pincer/pull/323
    • :sparkles: Add timeouts. by @ooliver1 in https://github.com/Pincer-org/Pincer/pull/324
    • :sparkles: Components by @Lunarmagpie in https://github.com/Pincer-org/Pincer/pull/321
    • :bug: filter out message fields if None instead of False by @TheBobBobs in https://github.com/Pincer-org/Pincer/pull/331
    • :bug: Fixes post_send_handler deleting channel instead of message by @TheBobBobs in https://github.com/Pincer-org/Pincer/pull/332
    • :bug: :sparkles: Added VERY basic sharding support and fixed the gateway by @Lunarmagpie in https://github.com/Pincer-org/Pincer/pull/329
    • :sparkles: Added 12 endpoints to Channel by @DarviL82 in https://github.com/Pincer-org/Pincer/pull/337
    • :pencil: updated README by @Lunarmagpie in https://github.com/Pincer-org/Pincer/pull/335
    • :bug: ActivityFlags no longer crash by @Lunarmagpie in https://github.com/Pincer-org/Pincer/pull/339
    • :sparkles: Message options by @Endercheif in https://github.com/Pincer-org/Pincer/pull/330

    New Contributors

    • @DarviL82 made their first contribution in https://github.com/Pincer-org/Pincer/pull/316
    • @Kylianalex made their first contribution in https://github.com/Pincer-org/Pincer/pull/319
    • @TheBobBobs made their first contribution in https://github.com/Pincer-org/Pincer/pull/331

    Full Changelog: https://github.com/Pincer-org/Pincer/compare/0.14.0...0.15.0

    Source code(tar.gz)
    Source code(zip)
  • 0.14.0(Dec 14, 2021)

    What's Changed

    • :passport_control: added User-Agent header by @Lunarmagpie in https://github.com/Pincer-org/Pincer/pull/274
    • Removing _http passing and getting it from the client by @Sigmanificient in https://github.com/Pincer-org/Pincer/pull/272
    • :art: Improving overall Pincer objects representation by @Sigmanificient in https://github.com/Pincer-org/Pincer/pull/285
    • Moved API Files To A Better More Organized Location by @VincentRPS in https://github.com/Pincer-org/Pincer/pull/286
    • :sparkles: Changes File class to allow for certain endpoints more easily by @Lunarmagpie in https://github.com/Pincer-org/Pincer/pull/282
    • :sparkles: Added Webhook related endpoints by @trag1c in https://github.com/Pincer-org/Pincer/pull/281
    • :speech_balloon: Fixing Grammar by @VincentRPS in https://github.com/Pincer-org/Pincer/pull/247
    • :speech_balloon: Make gitmoji mandatory by @Endercheif in https://github.com/Pincer-org/Pincer/pull/289
    • :memo: Added Interaction guide by @Lunarmagpie in https://github.com/Pincer-org/Pincer/pull/288
    • ✨ Add more guild methods by @Endercheif in https://github.com/Pincer-org/Pincer/pull/275
    • :sparkles: Added sticker support by @Endercheif in https://github.com/Pincer-org/Pincer/pull/292
    • 🐛 Transform message.edit list of APIObject to JSONSerializable by @drawbu in https://github.com/Pincer-org/Pincer/pull/306
    • :technologist: Adding Visual Studio Configs To gitignore by @VincentRPS in https://github.com/Pincer-org/Pincer/pull/307
    • :sparkles: Guild & Channel properties for APIObjects by @Lunarmagpie in https://github.com/Pincer-org/Pincer/pull/298

    Full Changelog: https://github.com/Pincer-org/Pincer/compare/0.13.0...0.14.0

    Source code(tar.gz)
    Source code(zip)
  • 0.13.0(Nov 30, 2021)

    What's Changed

    • :boom: Better command types and application command types by @Lunarmagpie in https://github.com/Pincer-org/Pincer/pull/246
    • :children_crossing: new example with PIL by @drawbu in https://github.com/Pincer-org/Pincer/pull/241
    • :sparkles: :zap: Added Mentionable type and improved Interaction performance by @Lunarmagpie in https://github.com/Pincer-org/Pincer/pull/253
    • :art: Middleware no longer returns API objects in list by @Lunarmagpie in https://github.com/Pincer-org/Pincer/pull/259
    • :sparkles: Added Audit Log and Emoji related Guild methods by @trag1c in https://github.com/Pincer-org/Pincer/pull/267
    • :sparkles: Added GuildTemplate related endpoints by @trag1c in https://github.com/Pincer-org/Pincer/pull/271
    • :sparkles: Implements Ratelimiter to prevent 429s from user scope by @Lunarmagpie in https://github.com/Pincer-org/Pincer/pull/264

    New Contributors

    • @snyk-bot made their first contribution in https://github.com/Pincer-org/Pincer/pull/258
    • @drawbu made their first contribution in https://github.com/Pincer-org/Pincer/pull/241

    Full Changelog: https://github.com/Pincer-org/Pincer/compare/0.12.1...0.13.0

    Source code(tar.gz)
    Source code(zip)
  • 0.12.1(Nov 24, 2021)

  • 0.12.0(Nov 24, 2021)

    What's Changed

    • Ability to send messages to users. Hex color class to work with User banner colors and anything with that format in the future.
    • Explicit args in Guild.ban() and Guild.kick(). Message Context.ack() is now optional.
    • Allow non-parenthesised @command decorator
    • Fixing payload to objects transformation
    • Added client and guild methods, GuildPreview object

    Contributors

    @Lunarmagpie @RPSMain @Sigmanificient @beastmatser @trag1c @Endercheif

    Source code(tar.gz)
    Source code(zip)
  • 0.11.4(Nov 18, 2021)

    • Adding loop_for and wait_for event for the bot
    • Adding flash sub package to optimize asynchronous performances
    • Toggable command register behavior
    • Checking snowflake boundaries

    Bug Fixes:

    • corrected route call for kick & ban methods
    • proper http closing when bot crash within it initialization
    Source code(tar.gz)
    Source code(zip)
  • 0.11.2(Nov 16, 2021)

  • 0.11.1(Nov 15, 2021)

    What's Changed

    • Added me,hoisted_role, kick & ban to guild members
    • Added fetch_message
    • Added get_avatar_url & get_avatar to user
    • Major BugFixes

    New Contributors

    • @VincentRPS made their first contribution in https://github.com/Pincer-org/Pincer/pull/193

    Full Changelog: https://github.com/Pincer-org/Pincer/compare/0.10.1...0.11.1

    Source code(tar.gz)
    Source code(zip)
  • 0.10.1(Nov 14, 2021)

    What's Changed

    • Adds UserMessage endspoints (Reactions, Edit, and Delete) by @Lunarmagpie in https://github.com/Pincer-org/Pincer/pull/157
    • :sparkles: Support Discord Gateway Event Compression by @mwath in https://github.com/Pincer-org/Pincer/pull/160
    • ✨ Guild registration, guild commands fix, interaction response methods, message delete_after and HTTPMeta rewrite, post_init automatic conversion, channel send & delete, add headers to http request by @Arthurdw in https://github.com/Pincer-org/Pincer/pull/158
    • ✨ Implement Guild Member Middleware by @Lunarmagpie in https://github.com/Pincer-org/Pincer/pull/162
    • ✅ Improve test coverage for core/Heartbeat.py (#121) by @gillesigot in https://github.com/Pincer-org/Pincer/pull/169
    • ✨ 🐛 new interaction features, bugfix and refactor by @Arthurdw in https://github.com/Pincer-org/Pincer/pull/167
    • 🐛 Pillow images can be sent in an interaction by @Lunarmagpie in https://github.com/Pincer-org/Pincer/pull/179
    • 📝 Upgrade docs by @ooliver1 in https://github.com/Pincer-org/Pincer/pull/155
    • :sparkles: Middleware addition by @Endercheif in https://github.com/Pincer-org/Pincer/pull/163
    • :sparkles: Add middleware by @beastmatser in https://github.com/Pincer-org/Pincer/pull/174
    • 🔖 0.10.1 - Doc Rewrite by @Sigmanificient in https://github.com/Pincer-org/Pincer/pull/213

    New Contributors

    • @gillesigot made their first contribution in https://github.com/Pincer-org/Pincer/pull/169
    • @ooliver1 made their first contribution in https://github.com/Pincer-org/Pincer/pull/155
    • @beastmatser made their first contribution in https://github.com/Pincer-org/Pincer/pull/174

    Full Changelog: https://github.com/Pincer-org/Pincer/compare/0.9.3...0.10.1

    Source code(tar.gz)
    Source code(zip)
  • 0.10.0(Nov 7, 2021)

    • proper closing/restart
    • ack & ctx interaction
    • Descripted annotation
    • Type Casting
    • Gateway compression
    • Guild member middleware
    • New str defaults
    • Invite link property
    • Message delete_after
    • Guild registeration
    • Discord changes
    • Emoji reaction functions
    • BugFixes
    Source code(tar.gz)
    Source code(zip)
  • 0.9.3(Oct 18, 2021)

    Changes

    • Added the ability to register events multiple times. (except for the on_command_error event to prevent conflicts)
    • Iteration improvements

    Bugfixes

    • Resolved the issue where already existing global commands were not being removed
    Source code(tar.gz)
    Source code(zip)
  • 0.9.2(Oct 14, 2021)

    Just a generic patch, with some important bugfixes and useful new command argument types

    Changes

    • Changed to LF file endings.
    • Internal refactoring
    • Documentation updates/typo fixes
    • Added float, User, Channel and Role command argument type

    Bugfixes

    • Broken guild only commands
    • Bot loading in specific architecture
    Source code(tar.gz)
    Source code(zip)
  • 0.9.1(Oct 9, 2021)

    There is now support for any bytes. Pillow JPG and PNG images and files have helper functions. Other formats can be sent by constructing a file object manually.

    Example

    Pillow image

    class Bot(Client):
        
        @command(description="Test method")
        async def test(self):
    
            img = Image.new("RGB",(500,500),(20,20,20))
    
           # Method one if you want to specify an image format. The file extension is used as the format.
            return Message(attachments=[
                File.from_image(
                    img,
                    "image.png"
                )
            ])
    
          #Method 2 & 3, can only do PNGs.
          return img
          return Message(attachments=[img])
    
    

    Sending a file

    class Bot(Client):
        
        @command(description="Test method")
        async def test(self):
    
            return Message(attachments=[
                File.from_file(
                     "test/something.txt"
                      #Filename can be specified if wanted
                     filename="somethingelse.txt"
                )
            ])
    
          # Can also be done like a png
          return Message(attachments=["test/something.txt"])
          
          # but this returns a message. Someone is gonna be baited by this. Probably me :(.
          return "something.txt"
          
    
    Source code(tar.gz)
    Source code(zip)
  • 0.9.0(Oct 4, 2021)

    Implemented cogs and channel.edit

    Basic cogs example:

    run.py

    >>> from pincer import Client
    >>>
    >>> class BotClient(Client):
    ...     def __init__(self, *args, **kwargs):
    ...         self.load_cog("cogs.say")
    ...         super().__init__(*args, **kwargs)
    

    cogs/say.py

    >>> from pincer import command
    >>>
    >>> class SayCommand:
    ...     @command()
    ...     async def say(self, message: str) -> str:
    ...         return message
    >>>
    >>> setup = SayCommand
    

    Note on setup method

    The setup method may have 1 optional argument which contains the client. The only restriction on the setup method is that it must be a callable, this means that the following code is also valid:

    def setup(client):
        return MyCog(client.bot.name)
    
    Source code(tar.gz)
    Source code(zip)
  • 0.8.0(Oct 3, 2021)

    Version 0.8.0 release:

    Changes

    • Implemented argument choices
    • Bugfix for Optional and descriptions

    Tasks

    Might be changed in future version

    functional way

    
    client = Bot(...)
    task = TaskScheduler(client)
    
    
    @task.loop(minutes=3)
    async def my_task(self):
        print(">w<")
    
    my_task.start()
    client.run()
    

    OOP way

    class Bot(Client):
        ...
    
        @Client.event
        async def on_ready(self):
            task = TaskScheduler(self)
    
            @task.loop(seconds=3)
            async def sample():
                print(">w<")
    
            sample.start()
    
    
    Bot(...).run()
    
    Source code(tar.gz)
    Source code(zip)
  • 0.7.2(Oct 2, 2021)

    Changes

    • Implemented argument choices
    • Bugfix for Optional and descriptions

    Example

    You can add choices to arguments through the pincer.Choices (which is an alias for typing.Literal). Choice values must consist of the same type, and there can only be a maximum of 25 choices.

    @command()
    async def choose(self, choice: Choices["Test", "Sample lol", "Geheh"]):
        return f"You chose: `{choice}`"
    

    image

    Example with custom name/value

    You can manually override the default name (which is set to the value) of a choice. This is done through a tuple, where the first value is the choice name and the second one is the value. These can be combined with default choices. (so no tuple, as seen in the example)

    @command()
    async def choose(
            self,
            choice: Choices[
                ("This will be the test value", "Test"),
                "Sample lol",
                "Geheh"
            ]
    ):
        return f"You chose: `{choice}`"
    

    image

    (So when This will be the test value is selected the bot will return You chose: 'Test')

    Source code(tar.gz)
    Source code(zip)
  • 0.7.1(Oct 2, 2021)

    This version implement the support for argument descriptions.

    Examples

    before 0.7.1 still suppported

    @command(description="Add two numbers!")
    async def add(
            first: int,
            second: int
    ):
        return f"The addition of `{first}` and `{second}` is `{first + second}`"
    

    argument descriptions

    @command(description="Add two numbers!")
    async def add(
            first: (int, "The first number"),
            second: (int, "The second number")
    ):
        return f"The addition of `{first}` and `{second}` is `{first + second}`"
    

    Result within discord

    image

    Source code(tar.gz)
    Source code(zip)
  • 0.7.0(Sep 28, 2021)

  • 0.6.10(Sep 20, 2021)

  • 0.6.9(Sep 19, 2021)

    Introducing yieldable command (thx to Endercheif)

    Example

        @command(guild=881531065859190804)
        async def lottery(self, numbers: int, guess: int):
            if numbers < 1:
                yield 'Please try again with 2 or more numbers'
                return
            
            elif numbers > 100:
                yield 'Please try again with 100 or less numbers'
                return
    
            yield f'Your {numbers} lucky numbers for today are:'
    
            has_won = False
            for _ in range(numbers):
                num = random.randint(0, 100)
    
                yield f'{num}'
                if num == guess:
                    has_won = True
    
            if has_won:
                yield f'Congratulations! {guess} was a winning number.'
            else:
                yield f'You tried your best'
    
    
    Source code(tar.gz)
    Source code(zip)
  • 0.6.8(Sep 17, 2021)

  • 0.6.6(Sep 13, 2021)

    | :exclamation: | The package is currently within the planning phase | | ------------- | :------------------------------------------------- |

    Core HTTP changes, Gateway Intents and bug fixes

    Changes

    • General code refactoring
    • Changed the way how the HttpClient is used
    • Implemented Discord Gateway events (Note: No extra middle-ware has been added, so unknown events will raise an exception)
    • Refactored the way library event middle-ware will be created

    Bug fixes

    • Some messages not being sent because of embed checks
    • Per guild command registration endpoints not being reset

    Special thanks

    We would like to thank @Maneren for improving the HttpClient module and the way it is being used!

    Source code(tar.gz)
    Source code(zip)
  • 0.6.5(Sep 11, 2021)

    | :exclamation: | The package is currently within the planning phase | | ------------- | :------------------------------------------------- |

    • Fixed set_thumbnail & set_image setters
    • Added mass field adder
    • Added Embed return within commands.

    Example

    Basic embed

    @command(description="How to make embed!")
    async def embed_test(self):
        return Embed(
            title="Pincer - 0.6.4",
            color=16768339,
            description=(
                "🚀 An asynchronous python API wrapper meant to replace"
                " discord.py\n> Snappy discord api wrapper written "
                "with aiohttp & websockets"
            ),
        ).add_field(
            name="**Github Repository**",
            value="> https://github.com/Pincer-org/Pincer"
        ).set_thumbnail(
            url="https://pincer.dev/img/icon.png"
        ).set_image(
            url=(
                "https://repository-images.githubusercontent.com"
                "/400871418/045ebf39-7c6e-4c3a-b744-0c3122374203"
            )
        )
    
    
    Source code(tar.gz)
    Source code(zip)
  • 0.6.4(Sep 10, 2021)

    | :exclamation: | The package is currently within the planning phase | | ------------- | :------------------------------------------------- |

    Bugfix for the command guild registration and added some more objects.

    Source code(tar.gz)
    Source code(zip)
  • 0.6.3(Sep 10, 2021)

    | :exclamation: | The package is currently within the planning phase | | ------------- | :------------------------------------------------- |

    Just fixes issues with the PyPi readme.

    Source code(tar.gz)
    Source code(zip)
Owner
Pincer
🚀 An asynchronous python API wrapper meant to replace discord.py - Snappy discord api wrapper written with aiohttp & websockets
Pincer
This project is based on discord.py and is meant to be a 'Quick Start Bot' to cut down on the time it takes to write complex discord bots.

This project is based on discord.py and is meant to be a 'Quick Start Bot' to cut down on the time it takes to write complex discord bots.

Alec Ibarra 1 Mar 3, 2022
An almost dependency-less, synchronous Discord gateway library meant for my personal use

An almost dependency-less, synchronous Discord gateway library meant for my personal use.

h0nda 4 Feb 5, 2022
A Google Charts API for Python, meant to be used as an alternative to matplotlib.

GooPyCharts A Google Charts API for Python 2 and 3, meant to be used as an alternative to matplotlib. Syntax is similar to MATLAB. The goal of this pr

Sagnik Ghosh 202 Oct 4, 2022
Receive GitHub webhook events and send to Telegram chats with AIOHTTP through Telegram Bot API

GitHub Webhook to Telegram Receive GitHub webhook events and send to Telegram chats with AIOHTTP through Telegram Bot API What this project do is very

Dash Eclipse 33 Jan 3, 2023
Asynchronous Python Wrapper for the GoFile API

Asynchronous Python Wrapper for the GoFile API

Gautam Kumar 22 Aug 4, 2022
Asynchronous Python Wrapper for the Ufile API

Ufile.io Asynchronous Python Wrapper for the Ufile API (Unofficial).

Gautam Kumar 16 Aug 31, 2022
ro.py is a modern, asynchronous Python 3 wrapper for the Roblox API.

GitHub | Discord | PyPI | Documentation | Examples | License Overview Welcome to ro.py! ro.py is an asynchronous, object-oriented wrapper for the Robl

ro.py 81 Dec 26, 2022
Asynchronous Guilded API wrapper for Python

Welcome to guilded.py, a discord.py-esque asynchronous Python wrapper for the Guilded API. If you know discord.py, you know guilded.py. Documentation

shay 115 Dec 30, 2022
Asynchronous Python API Wrapper for phisherman.gg

Asynchronous Python API Wrapper for phisherman.gg

Qrista Labs 4 Apr 30, 2022
Fully asynchronous trace.moe API wrapper

AioMoe Fully asynchronous trace.moe API wrapper Installation You can install the stable version from PyPI: $ pip install aiomoe Or get it from github

null 2 Jun 26, 2022
Python script to replace BTC adresses in the clipboard with similar looking ones, whose private key can be retrieved by a netcat listener or similar.

BTCStealer Python script to replace BTC adresses in the clipboard with similar looking ones, whose private key can be retrieved by a netcat listener o

Some Person 6 Jun 7, 2022
Pinopoly is a tool to remove the "banker" player and replace them with a digitalized system

Pinopoly is a tool to remove the "banker" player and replace them with a digitalized system. It is intended to be used on a Raspberry Pi but can be used in the command line as well.

Alex Overstreet 11 Jul 9, 2022
Replace sequence_IDs in gff3 based on given genome.fasta

gff-rename Replace the sequence IDs in a gff3 file with a set of provided sequence IDs from a genom.fasta. This is useful when a gff3 file is retrieve

tolkit 1 Nov 12, 2021
A head unit UI designed to replace the RTx/SMEG/RNEG/NG4/RCC/NAC

HeadUnit UI (Come discuss about it on our Discord!) Intro This is the UI part of a headunit project from OpenLeo, based on python and kivy, it looks l

OpenLeo 6 Nov 23, 2022
Asynchronous wrapper для Gismeteo.ru.

aiopygismeteo Асинхронная обёртка для Gismeteo.ru. Синхронная версия здесь. Установка python -m pip install -U aiopygismeteo Документация https://aiop

Almaz 6 Dec 8, 2022
Asynchronous wrapper for wttr.in weather forecast.

aiopywttr Asynchronous wrapper for wttr.in weather forecast. Synchronous version here. Installation pip install aiopywttr Example This example prints

Almaz 4 Dec 24, 2022
A Anything goes Discord bot written in python and uses the wrapper Discord.py

GerardTheWizard A Anything goes Discord bot written in python and uses the wrapper Discord.py What can he do? Allow users to level up through typing,

null 1 May 5, 2022
Discord-Wrapper - Discord Websocket Wrapper in python

This does not currently work and is in development Discord Websocket Wrapper in

null 3 Oct 25, 2022
🖥️ Python - P1 Monitor API Asynchronous Python Client

??️ Asynchronous Python client for the P1 Monitor

Klaas Schoute 9 Dec 12, 2022