🚀 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.

Issues
  • ✨ Middleware implementation

    ✨ Middleware implementation

    Most middleware still has to be implemented.

    Some files are already present in pincer.middleware.

    Find the events here

    enhancement easy 
    opened by Arthurdw 14
  • ⚡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
  • 🔨 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
  • 📝 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
  • 📝 Document code further

    📝 Document code further

    Further document docstrings &/or create documentation where none is present but is needed.

    documentation help wanted 
    opened by Arthurdw 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
  • ✨ Implement Guild Methods

    ✨ Implement Guild Methods

    Many of the guild methods are yet to be added. This issue will serve as a checklist for them. If you want to become a contributor, implementing a few of these is a good first issue. This issue will be divided up into parts. If you are working on some methods, comment on what you are doing so that you can be assigned to it and there would not be others doing the same thing.

    enhancement easy 
    opened by Endercheif 7
  • :sparkles: added get_shard method to client

    :sparkles: added get_shard method to client

    Changes

    • adds: get_shard method to client
    • fixed: get_shard method to client
    • improvements: get_shard method to client

    This is required for implementing good voice support so its part of #356 I've decided to stop making PRs that are too big :smiley:

    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 1
  • :sparkles: Better way to register guild commands

    :sparkles: Better way to register guild commands

    Bot currently checks every single guild the client is registered to when getting guild commands. Bad obviously, think the best way to fix it is to let the user specify the guilds or something. I checked the discord docs and didn't see anything that would fix the issue.

    opened by Lunarmagpie 0
  • :sparkles: Adding message history

    :sparkles: Adding message history

    c = await self.get_channel(...)
    
    async for m in c.history(limit=1000):
        # To your stuff
    
    opened by Sigmanificient 1
  • :sparkles: Add support for Annotated type hint for command arguments and deprecate CommandArg

    :sparkles: Add support for Annotated type hint for command arguments and deprecate CommandArg

    Changes

    • adds: title
    • fixed: Choices no longer converts second argument to str every time
    • improvements: Annotated

    I tested Aliasing Annotated btw and pylint doesn't like it.

    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 1
  • :sparkles: Add permission handler

    :sparkles: Add permission handler

    Changes

    This adds a permission handler which can convert integers in the correct permission and vice versa.

    Check off the following

    • [x] I have tested my changes with the current requirements
    • [x] My Code follows the pep8 code style.
    opened by beastmatser 5
  • :bug: Workflow

    :bug: Workflow "sort-all" fail when nothing to commit

    Describe the bug

    Since sort-all is active on all branch, it now fail on pr if there is nothing to sort

    Relevant console output

    see here

    bug 
    opened by Sigmanificient 0
  • :bug: Switch CommandArg to use Annotated so it is complient with python typing

    :bug: Switch CommandArg to use Annotated so it is complient with python typing

    https://docs.python.org/3/library/typing.html#typing.Annotated Also the rest of the types will need some slight changing

    opened by Lunarmagpie 2
  • :bug: Add concurrent shard startups

    :bug: Add concurrent shard startups

    Currently shards are all started at the same time. Should do this this. Only the Client.run methods and similar will need to be changed probably.

    bug 
    opened by Lunarmagpie 0
  • :bug: Fix zlib-stream compression for the Gateway

    :bug: Fix zlib-stream compression for the Gateway

    When using zlib-stream compression, the bot can crash with an error like invalid block lengths. I found that stopping and starting the bot really quickly in succession is an easy way to recreate the error. I think it can also happen after the bot is running for a while though.

    Everything that needs to be changed should be contained to pincer.core.Gateway. __buffer already exists to store the buffer. There is only one global inflator though, I have no idea if each shard needs one.

    GatewayConfig should be imported and do GatewayConfig.compression = "zlib-stream" to change the compression type while testing.

    bug 
    opened by Lunarmagpie 0
  • :sparkles: Add voice states for the client

    :sparkles: Add voice states for the client

    The should be a function to request a VoiceState and VoiceServer object from the gateway. The function should look like this (this is inspired by Hikari)

    @command
    async def something(self: Client):
        self.voice.connect_to(GUILD_ID, channel_id, connection_type=InheritsFromVoiceABC)
    

    There should also be a leave function that can be run when the bot is shut down. We can make that run automatically later. A VoiceABC object will be added so that people can make their own voice systems that work with Pincer easily.

    Some Technical Notes: A system to save a reference to each shard needs to be added. There then needs to be a way to retrieve them using a guild id. https://discord.com/developers/docs/topics/gateway#sharding-sharding-formula May be a good idea to implement that in a PR before touching this.

    This supersedes #217

    enhancement 
    opened by Lunarmagpie 0
Releases(0.15.3)
  • 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)
  • 0.6.2(Sep 10, 2021)

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

    Message object + per guild commands

    Implemented a message object which can be used to further customize your response, and set the ability to set per guild commands.

    Example

    Usage example:

    @command(guild=728278830770290759)
    async def private(self, message: str):
        return Message(message, flags=InteractionFlags.EPHEMERAL)
    
    Source code(tar.gz)
    Source code(zip)
  • 0.6.1(Sep 9, 2021)

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

    Command bugfixes

    Resolved the following issues:

    • Empty parameter error
    • Reposting existing commands bug
    • General typo refactoring
    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
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 3 Dec 1, 2021
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 204 Jan 11, 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 27 Dec 28, 2021
Asynchronous Python Wrapper for the GoFile API

Asynchronous Python Wrapper for the GoFile API

Gautam Kumar 22 Jan 10, 2022
Asynchronous Python Wrapper for the Ufile API

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

Gautam Kumar 15 Oct 8, 2021
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 60 Jan 18, 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 64 Jan 7, 2022
Asynchronous Python API Wrapper for phisherman.gg

Asynchronous Python API Wrapper for phisherman.gg

Qrista Labs 2 Jan 13, 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 3 Oct 5, 2021
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 4 Oct 27, 2021
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 12 Jun 25, 2021
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 1 Jan 7, 2022
Asynchronous wrapper для Gismeteo.ru.

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

Almaz 5 Jan 1, 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 Jan 10, 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 Dec 29, 2021
🖥️ Python - P1 Monitor API Asynchronous Python Client

??️ Asynchronous Python client for the P1 Monitor

Klaas Schoute 2 Jan 10, 2022
My personal template for a discord bot, including an asynchronous database and colored logging :)

My personal template for a discord bot, including an asynchronous database and colored logging :)

Timothy Pidashev 2 Jan 9, 2022
Discord-Wrapper - Discord Websocket Wrapper in python

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

null 2 Jan 9, 2022