A discord http interactions framework built on top of Sanic

Overview

snowfin

An async discord http interactions framework built on top of Sanic

Installing

for now just install the package through pip via github

# Unix based
pip3 install git+https://github.com/kajdev/snowfin

# Windows
py -m pip install git+https://github.com/kajdev/snowfin

Example

Simple slash command

import snowfin
from snowfin.response import MessageResponse

bot = snowfin.Client('public_key')

@snowfin.SlashCommand(name="hello")
async def on_slash(request):
    return MessageResponse('world')

bot.run("0.0.0.0", 80, debug=True)

Slash command with a deferred response

import asyncio
import snowfin
from snowfin.response import DeferredResponse, MessageResponse

bot = snowfin.Client('public_key')

@snowfin.SlashCommand(name="hello")
async def on_slash(request):
    return DeferredResponse(on_slash_defer)

async def on_slash_defer(request):
    await asyncio.sleep(1)
    return MessageResponse('Ok, *Now* I want to respond ;)')

bot.run("0.0.0.0", 80, debug=True)

Links

You might also like...
domhttpx is a google search engine dorker with HTTP toolkit built with python, can make it easier for you to find many URLs/IPs at once with fast time.
domhttpx is a google search engine dorker with HTTP toolkit built with python, can make it easier for you to find many URLs/IPs at once with fast time.

domhttpx is a google search engine dorker with HTTP toolkit built with python, can make it easier for you to find many URLs/IPs at once with fast time

A Discord Bot - has a few commands. Built using python - Discord.py - RIP.
A Discord Bot - has a few commands. Built using python - Discord.py - RIP.

Discord_Bot A Discord Bot has been built here. It is capable of running a few commands. The below present screenshot should suffice in terms of explai

Bypass Hcaptcha Purely based on http requests, Creates unlocked discord accounts if used correctly

hcaptcha-bypass-discord Bypass HCAPTCHA purely based on http requests Works for discord dosen't create locked accounts :)) HOW TO USE โ—‰ add the hcapby

Useful tools for building interactions in Python

discord-interactions-python Types and helper functions for Discord Interactions webhooks. Installation Available via pypi: pip install discord-interac

Typed interactions with the GitHub API v3

PyGitHub PyGitHub is a Python library to access the GitHub API v3 and Github Enterprise API v3. This library enables you to manage GitHub resources su

๐Ÿ“ท Instagram Bot - Tool for automated Instagram interactions
๐Ÿ“ท Instagram Bot - Tool for automated Instagram interactions

InstaPy Tooling that automates your social media interactions to โ€œfarmโ€ Likes, Comments, and Followers on Instagram Implemented in Python using the Se

This package allows interactions with the BuyCoins API.

The BuyCoins Python library allows interactions with the BuyCoins API from applications written in Python.

Unit testing AWS interactions with pytest and moto. These examples demonstrate how to structure, setup, teardown, mock, and conduct unit testing. The source code is only intended to demonstrate unit testing.

Unit Testing Interactions with Amazon Web Services (AWS) Unit testing AWS interactions with pytest and moto. These examples demonstrate how to structu

It's a Discord bot to control your PC using your Discord Channel or using Reco: Discord PC Remote Controller App.
It's a Discord bot to control your PC using your Discord Channel or using Reco: Discord PC Remote Controller App.

Reco PC Server Reco PC Server is a cross platform PC Controller Discord Bot which is a modified and improved version of Chimera for Reco-Discord PC Re

Comments
  • Added logging level and description localizations

    Added logging level and description localizations

    Without description_localizations in the SlashOption class, an error would be raised when trying to make an option because the SlashOption class did not have the description_localizations attribute.

    Also set the logging level.

    opened by Shinobou 1
  • fix: added `snowfin.Client.command` and set the logging level

    fix: added `snowfin.Client.command` and set the logging level

    The issue with some commands is the command was not getting added to the bot. To fix this I added snowfin.Client.command. Now a command may look like:

    @bot.command
    @snowfin.slash_command(name="hello")
    async def hello(context: Interaction):
        return MessageResponse('Ok, *Now* I want to respond ;)')
    
    opened by Shinobou 1
  • Updated type hints of `User`

    Updated type hints of `User`

    While fetching the user, the avatar can sometimes be None. This would cause the raise of dacite.exceptions.WrongTypeError. Also changed the type hint of the user attribute of Client to Optional[User] as it was declared as None.

    opened by Shinobou 1
  • Callback loading bug

    Callback loading bug

    Since commands and callbacks are on each client, calling the decorators snowfin.slash_command, snowfin.select_callback, etc., does not work as it doesn't load the callbacks into the client. Tested with https://github.com/KAJdev/snowfin/blob/main/examples/deferred_example.py and https://github.com/KAJdev/snowfin/blob/main/examples/component_example.py.

    It seems like it requires it to be a Module, and load_module() must be called in order to properly load the callbacks into the client.

    Simple non-working example:

    import snowfin
    from snowfin.models import Interaction
    import asyncio
    
    bot = snowfin.Client(...)
    
    
    @snowfin.slash_command(name="hello")
    async def on_slash(context: Interaction):
        return snowfin.DeferredResponse(on_slash_defer)
    
    async def on_slash_defer(context: Interaction):
        await asyncio.sleep(1)
        return snowfin.MessageResponse('Ok, *Now* I want to respond ;)')
    
    
    bot.run("0.0.0.0", 8000, debug=True, auto_reload=True)
    
    opened by julien777z 1
Releases(v0.1.2-alpha)
  • v0.1.2-alpha(Jun 17, 2022)

    What's Changed

    • Add discord server link by @KAJdev in https://github.com/KAJdev/snowfin/pull/1
    • Rebase for now by @KAJdev in https://github.com/KAJdev/snowfin/pull/2
    • changes to readme by @xPolar in https://github.com/KAJdev/snowfin/pull/3
    • Bringing dev up do date yet again by @KAJdev in https://github.com/KAJdev/snowfin/pull/4
    • Fix event listeners and update examples by @KAJdev in https://github.com/KAJdev/snowfin/pull/5
    • fix 500s when request isn't from Discord by @KAJdev in https://github.com/KAJdev/snowfin/pull/6
    • fix some issues related to serialization of choices by @KAJdev in https://github.com/KAJdev/snowfin/pull/7
    • Updated type hints of User by @Shinobou in https://github.com/KAJdev/snowfin/pull/8
    • Rebase dev by @KAJdev in https://github.com/KAJdev/snowfin/pull/9
    • Merge dev into main by @KAJdev in https://github.com/KAJdev/snowfin/pull/10
    • v0.1.2 merge dev into master by @KAJdev in https://github.com/KAJdev/snowfin/pull/17

    New Contributors

    • @KAJdev made their first contribution in https://github.com/KAJdev/snowfin/pull/1
    • @xPolar made their first contribution in https://github.com/KAJdev/snowfin/pull/3

    Full Changelog: https://github.com/KAJdev/snowfin/commits/v0.1.2-alpha

    Source code(tar.gz)
    Source code(zip)
Owner
kaj
I do a whole bunch of Python stuff, and C# too.
kaj
Discord Panel is an AIO panel for Discord that aims to have all the needed tools related to user token interactions, as in nuking and also everything you could possibly need for raids

Discord Panel Discord Panel is an AIO panel for Discord that aims to have all the needed tools related to user token interactions, as in nuking and al

null 11 Mar 30, 2022
Spotify Top Lists - get the current top lists of a user from the Spotify API and display them in a Flask app

Spotify Top Lists This is a simple script that will get the current top lists of a user from the Spotify API and display them in a Flask app. Requirem

Yasin 0 Oct 16, 2022
Get charts, top artists and top songs WITHOUT LastFM API

LastFM Get charts, top artists and top songs WITHOUT LastFM API Usage Get stats (charts) We provide many filters and options to customize. Geo filter

null 4 Feb 11, 2022
It is a temporary project to study discord interactions. You can set permissions conveniently when you invite a particular disk code bot.

Permission Bot ๋””์Šค์ฝ”๋“œ ๋‚ด์— ์žˆ๋Š” message-components ๋ฅผ ์—ฐ๊ตฌํ•˜๊ธฐ ์œ„ํ•˜์—ฌ ์ œ์ž‘๋œ ๋ด‡์ž…๋‹ˆ๋‹ค. Setup /config/config_example.ini ํŒŒ์ผ์„ /config/config.ini์œผ๋กœ ๋ณ€ํ™˜ํ•ฉ๋‹ˆ๋‹ค. config ํŒŒ์ผ์˜ ๊ธฐ๋ณธ ์–‘์‹์€ ์•„

gunyu1019 4 Mar 7, 2022
Boilerplate template for the discord-py-interactions library

discord-py-interactions_boilerplate Boilerplate template for the discord-py-interactions library Currently, this boilerplate supports discord-py-inter

Ventus 7 Dec 3, 2022
A secure and customizable bot for controlling cross-server announcements and interactions within Discord

DiscordBot A secure and customizable bot for controlling cross-server announcements and interactions within Discord. Within the code of the bot, you c

Jacob Dorfmeister 1 Jan 22, 2022
Free and Open Source Machine Translation API. 100% self-hosted, no limits, no ties to proprietary services. Built on top of Argos Translate.

LibreTranslate Try it online! | API Docs Free and Open Source Machine Translation API, entirely self-hosted. Unlike other APIs, it doesn't rely on pro

UAV4GEO 3.5k Jan 3, 2023
Deep reinforcement learning library built on top of Neural Network Libraries

Deep Reinforcement Learning Library built on top of Neural Network Libraries NNablaRL is a deep reinforcement learning library built on top of Neural

Sony 100 Dec 14, 2022
A decentralized messaging daemon built on top of the Kademlia routing protocol.

parakeet-message A decentralized messaging daemon built on top of the Kademlia routing protocol. Now that you are done laughing... pictures what is it

Jonathan Abbott 3 Apr 23, 2022
Minimal Python client for the Iris API, built on top of Authlib and httpx.

??๏ธ Iris Python Client Minimal Python client for the Iris API, built on top of Authlib and httpx. Installation pip install dioptra-iris-client Usage f

Dioptra 1 Jan 28, 2022