GithubHelp home page GithubHelp logo

huyanematsu / hata Goto Github PK

View Code? Open in Web Editor NEW
177.0 7.0 21.0 26.17 MB

Async Discord API wrapper.

Home Page: https://www.astil.dev/project/hata/

License: Other

Python 98.43% Shell 0.01% Markdown 1.56%
discord-api-wrapper discord python hata discord-api async slash-commands bot api api-wrapper

hata's Introduction

A blazing fast Discord API wrapper that you can't deny

Support Guild | Topical documentation | Examples | Technical documentation | Source


New hata versions use Discord API V10 .

About

Hata is an asynchronous Discord API wrapper built on top of scarletio. It is designed to be easy to use, with also providing rich API offering everything what an advanced developer might need.

Named after Hata no Kokoro from Touhou Project.

Why hata?

  • Multiple simultaneous clients

    Hata can run multiple clients from the same instance without sacrificing performance.

  • Performant

    Fast concurrent code based on async/await paradigm with cache control, PyPy support and much more!

  • Newest API features

    Whatever Discord decides to release/update/break Hata will support it natively in no time!

  • 100% Python

    Built in Python! Easy to code, easy to read, easy to maintain.

Usage

Simple example implementing a ping command.

from hata import Client, Guild, wait_for_interruption

GUILD = Guild.precreate(guild_id)

Seija = Client('TOKEN', extensions = ['slash'])

@Seija.events
async def ready(client):
    print(f'{client:f} logged in.')

@Seija.interactions(guild = GUILD)
async def ping():
    """ping-pong"""
    return 'pong'

Seija.start()

wait_for_interruption()

Hata leaves the main thread free, client.start() blocks it only till the client logs in (or fails it), although you can still use the start_clients() function, what as it says, starts up all the non-running clients parallelly.

Sometimes leaving the main thread might cause problems when trying to shut down the bot(s). At this case, you might want to use wait_for_interruption(), which disconnects the clients gracefully and closes the event loop on keyboard interrupt.

Installation

To install Hata simply do

# Linux/OS X
$ python3 -m pip install hata

# Windows
$ python -m pip install hata

# Voice Support
$ python -m pip install hata[voice]

And you are good to go! Hata has native pypy support as well if you need some more speed!

Dependencies

Requirements

Optional

Get in touch

If you have issues, suggestions, want to contribute, or just want to hang out, join our discord server.

Invite

Acknowledgements

Shout-Out to our brave testers who are helping the most to improve Hata!

hata's People

Contributors

akiacode avatar albertopoljak avatar catzoo avatar fire6945 avatar foxeiz avatar huyanematsu avatar ryan5453 avatar tari-dev avatar technisha avatar wizzygeek avatar yu-vitaqua-fer-chronos avatar zeref-draganeel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

hata's Issues

passing guild owner

await client.guild_edit(guild, owner=user)
does not work
owner doesn't take anything yet

Documentation Improvement

Summary

  1. It's hard to navigate around the docs

  2. The search engine of the docs website is kinda strict
    (It makes it hard to find certain things)

  3. The other things aren't in the docs website (most people rely on the docs website rather than the github one)

Ideal Solution

  1. Add a sidebar like where we can see and/or fold other topics.

  2. Don't make it that much strict.

  3. Add the tutorials. Maybe add examples on how to use other useful things. Put everything in one place.

Use case code

No response

Alternative solutions

Recreate the whole website maybe on github docs

Additional Context

This issue is the input I took from other people who don't know what exactly hata is yet and my own feedback.

[Bug] hata.ext.patchouli can drop IndexError

Description

Unexpected IndexError when trying to serialize.

Reproduction Steps

Try to serialize .../hata/ext/solarlink/filters/Equalizer.

Reproduction Code

No response

Expected behaviour

No exception occurs.

Actual behaviour

Traceback (most recent call last):
  File ".../hata/ext/patchouli/module_mapper.py", line 497, in html_extended_with_structure
    html_extended, html_extended_structure = html_serialize_docs_extended(self, True, True)
  File ".../hata/ext/patchouli/builder_html_extended.py", line 1891, in html_serialize_docs_extended
    structure = serializer.structurize()
  File ".../hata/ext/patchouli/builder_html_extended.py", line 1574, in structurize
    child = section.structurize()
  File ".../hata/ext/patchouli/builder_html_extended.py", line 772, in structurize
    serializer = serializer_type(unit, path / name)
  File ".../hata/ext/patchouli/builder_html_extended.py", line 551, in __init__
    parameter_section = ParameterSection(section_content, object_, path)
  File ".../hata/ext/patchouli/builder_html_extended.py", line 1259, in __init__
    self.extend(section_content)
  File ".../hata/ext/patchouli/builder_html_extended.py", line 1289, in extend
    self.parameter_sub_sections.append(ParameterSubSection(header, section_content))
  File ".../hata/ext/patchouli/builder_html_extended.py", line 1028, in __init__
    parameter_name_part = header_contents[0]
IndexError: list index out of range

System information

Hata version: 1.3.4
Scarletio version: 1.0.34
Platform: Linux-5.13.0-1022-aws-x86_64-with-glibc2.2.5
Python implementation: cpython
Python version: 3.8 final

[Feature request] Client creating from class

Summary

I am trying to use a factory pattern and trying to make a create_app function. But I realized that I have to make so many parameters.

Ideal Solution

We could just make a config class that has the parametert

Use case code

from hata import Client
import os

class NueConfig:
  token = os.getenv('token')
  ...

Nue = Client.from_class(NueConfig)

# in my use case

def create_app(config, setup_slash=True, setup_commands=True, ...):
    client = Client.from_class(config)
    if setup_slash:
        setup_ext_slash(client)
    if setup_commmands:
        ....
    return client

Alternative solutions

we could also have Client.from_dict()

Additional Context

Factory pattern

[LONG-TERM] [SUGGESTION] Split up Hata into different repos

Hata currently is amazing, but it's all in one single repo. I think splitting it up into async, websockets, html server would be a LOT better, because that way people can use your async without downloading everything else, or the same with websockets. Having multiple projects also makes it easier to update code independent from eachother, so you don't have to change a while file to make one thing work, for example.

[Question] Add checks in decorator

Hello :P
I have an idea for a feature in Hata, I think it would be quite useful to be able to define a check in a decorator, e.g. on_command(permissions=['permission 1', 'permission 2', 'etc']), and a way to access it via client.events.commands["name"]["permissions"] which would be quite nice, it would return a list, and if no permissions were passed, then it would return [], this would be a nice feature to add, since it simplifies permission checks greatly, so what do you think?

[LONG-TERM] [SUGGESTION] Add AnyIO support to Hata

This is a long term suggestion, but adding AnyIO support to Hata might be a good idea, since then libaries that use a specific library or use AnyIO would also work in Hata. And while Hata async is faster then everything else, this also proves to others how much better it is (also gives you the option to use AnyIO in other projects and use Hata's async)

[Bug] Patchouli produces broken code blocks

Description

Patchouli builds broken code blocks.

Reproduction Steps

No response

Reproduction Code

No response

Expected behaviour

Every line should appear on a new line.

Actual behaviour

Line-breaks are missing.

System information

dev

[Bug] Interaction has already been acknowledged.

Description

Interaction has already been acknowledged.

Reproduction Steps

No response

Reproduction Code

No response

Expected behaviour

Been Normal

Actual behaviour

No response

System information

Newest

[FEATURE REQUEST] a description/text field on the command decorator

I need a way to store text in the command decorator and need it so I can get it from the case of the command, maybe it could be an extra field in client.events.message_create.commands? It would be very useful to be able to store text or even a dict about commands, if it can store any data type, that would be preferable since I can easily adapt this to my commands

[Bug] Can't use load_opus

Description

hata try to load opus lib at .venv\\lib\\site-packages\\hata\\discord\\voice\\bin\\libopus-0.x64.dll instead of .venv\\lib\\site-packages\\hata\\discord\\bin\\libopus-0.x64.dll

Reproduction Steps

No response

Reproduction Code

from hata.discord.voice.opus import load_opus

load_opus()

Expected behaviour

the opus lib load correctly

Actual behaviour

FileNotFoundError("Could not find module '.venv\\lib\\site-packages\\hata\\discord\\voice\\bin\\libopus-0.x64.dll' (or one of its dependencies). Try using the full path with constructor syntax.")

System information

Hata version: 1.1.132
Platform: Windows-7-6.1.7601-SP1
Python implementation: cpython
Python version: 3.8 final

[Feature request] Load directory as plugin from a plugin

Summary

It would be great if there would be an easy way to load all files and directories from a plugin __init__.py file.

Ideal Solution

Example code:

mark_as_plugin_root_directory()

Example file system:

plugin_directory
|- __init__.py
|- directory_n
|- file_n.py

Use case code

No response

Alternative solutions

Manually import all files & directories from the file's directory.

Additional Context

  1. __init__.py files stop further files to being loaded in that directory, so manual import is required.
  2. __init__.py files are required for relative imports.

Add an easy way to load extensions

I'd like to get an easy way to load extensions, since right now we have to do `python
EXTENSION_LOADER = ExtensionLoader(client)

def add_extensions():
async def entry(client, lib):
commands=getattr(lib,'commands',None)
if commands is not None:
client.events.message_create.shortcut.extend(commands)

    entry=getattr(lib,'entry',None)
    if entry is not None:
        if is_coro(entry):
            await entry(client)
        else:
            entry(client)
        
    print(f'{lib.__name__} extension has been loaded!')
    
async def exit(client, lib):
    commands=getattr(lib,'commands',None)
    if commands is not None:
        client.events.message_create.shortcut.unextend(commands)
    
    exit=getattr(lib,'exit',None)
    if exit is not None:
        if is_coro(exit):
            await exit(client)
        else:
            exit(client)

    print(f'{lib.__name__} extension has been unloaded!')

for filename in os.listdir('./cogs/'):
    if filename.endswith('.py'):
        module_name='cogs.'+filename[:-3]   EXTENSION_LOADER.add(module_name, entry_point=entry, exit_point=exit)

add_extensions()
EXTENSION_LOADER.load_all().syncwrap().wait()which is really annoying and is quite alot to try and remember, for discord.py all we have to do ispython
for file in os.listdir("./cogs/"):
if file.endswith('.py'):
client.load_extension(cogs.file.strip[:-3])which is alot easier to remember, I'd think this would be a nice feature to implement since it'll simplify cog loading alot, for hata you could dopython
client.load_extension("path_of_cog", "the name of the eventlist to load")`

[Bug] Custom ActivityRich causes TypeError

Description

Creating an ActivityRich, with a custom type_, causes a TypeError.

Reproduction Steps

  1. Execute reproduction code.

Reproduction Code

import hata
hata.ActivityRich('', type_=hata.ACTIVITY_TYPES.custom)

Expected behaviour

ValueError: `type_` can be any of: 0, 1, 2, 3, 5, got 4.

Actual behaviour

TypeError: sequence item 0: expected str instance, int found

System information

Hata version: 1.2.14
Scarletio version: 1.0.27
Platform: Windows-10-10.0.19041-SP0
Python implementation: cpython
Python version: 3.9 final

[FEATURE] Custom Stdout/err/in

Something that'd be pretty nifty would be wrappers around a channel that could be used is stdout/stderr/stdin in Hata. An example would be

hstdout, hstderr, hstdin = get_channel_std(Client, Channel)

That could be used exactly like stdout/stderr/stdin as drop in alternatives for anything else that need std, so redirecting logging to a channel, or a shell like bash

[Bug] Example basic voice broken?

Description

When trying to implement the example basic voice I cant even let the bot join because AttributeError: 'InteractionEvent' has no attribute '.voice_state'.

Reproduction Steps

run the example code

Reproduction Code

@Sakuya.interactions(guild = MY_GUILD)
async def join(client, event):
    """Joins to voice channel."""
    # Getting the author voice state
    voice_state = event.voice_state
    if voice_state is None:
        return 'You are not at a voice channel!'
    
    # Connecting the client to the same channel, where the user is.
    try:
        await client.join_voice(voice_state.channel)
    except TimeoutError:
        # Could not connect.
        return 'Timed out meanwhile tried to connect.'
    
    except RuntimeError:
        # Not every required library is installed.
        return 'The client cannot play voice, some libraries are not loaded.'
    
    # Great success.
    return f'Joined to {voice_state.channel.name}'

Expected behaviour

the bot to join

Actual behaviour

AttributeError thrown

System information

Hata version: 1.3.53
Scarletio version: 1.0.68
Platform: macOS-14.2.1-arm64-arm-64bit
Python implementation: cpython
Python version: 3.11 final

[Feature request] ApplicationCommand.__hash__ for partial instances

Summary

ApplicationCommand.__hash__ should work partial instances as well.

Ideal Solution

Produce hash value based on fields which are allowed for partial application commands.

Use case code

application_commands = [*{*application_commands}]

Alternative solutions

Write the logic outside the library.

Additional Context

No response

[Feature Request] Object binding

Summary

A cool hata feature would be the ability to bind objects to an existing object, and depending on what that is, have it be initialised and share the data of the class that an object has been bound to. This would also need a way to detect if the object that is meant to be bound to an object is a class and needs to be initialised, including if it is asynchronous or not.

Ideal Solution

A bind function could loosely be implemented with a method that accepts 3 parameters. The first being the object being bound to, the second being the target object to bind, and the third being the initialised name of the object.

Use case code

from hata import User, bind

class Inventory(object):
    def __init__(self, parent_self):
        self.user = parent_self
        self.inv = []

    def add_item(self, name):
        self.inv.append(name)

    def give_user(self, item, recipient):
        del self.inv[self.inv.index(item)]
        recipient.inventory.add_item(item)


bind(User, Inventory, 'inventory')  # Parent object, new class, initialised object name

# Note this is a very bad example. This should also be doable with functions and variables, simply just adding them to the parent object.

Alternative solutions

While i could simply just keep them separate, it would be more convenient and beneficial to be able to bind related objects together, as they will never be used without eachother.

Additional Context

No response

[Bug] Row.copy_with raises NameError

Description

With my code, I decided to try to copy Row only with different components. When I ran copy_with, it came back with an error. I thought at first this was my code since it was a bit messy at the time. So, I tested it in a different file without running the bot, the same error came back.

The reproduction code below is what the test file included. It would be easier to create a new Row object rather than copying it, but I was mainly messing around with components and seeing what I can do.

Reproduction Steps

No response

Reproduction Code

from hata import BUILTIN_EMOJIS
from hata.ext.slash import Button, Row

# Paginator buttons
PAGE_FIRST = Button(emoji=BUILTIN_EMOJIS["track_previous"])
PAGE_LAST = Button(emoji=BUILTIN_EMOJIS["track_next"])
PAGE_NEXT = Button(emoji=BUILTIN_EMOJIS["arrow_right"])
PAGE_PREVIOUS = Button(emoji=BUILTIN_EMOJIS["arrow_left"])

PAGE_BUTTONS = Row(PAGE_FIRST, PAGE_PREVIOUS, PAGE_NEXT, PAGE_LAST)

TEST = PAGE_BUTTONS.copy_with(components=[PAGE_FIRST])

Expected behaviour

copy_with return the new object with different components.

Actual behaviour

This error came up:

Traceback (most recent call last):
  File "C:\Users\Catzoo Bob\Desktop\Github\discord-channel-bot\bot\test.py", line 12, in <module>
    TEST = PAGE_BUTTONS.copy_with(components=[PAGE_FIRST])
  File "C:\Users\Catzoo Bob\Desktop\Github\discord-channel-bot\bot\bot-env\lib\site-packages\hata\discord\interaction\components.py", line 658, in copy_with
    self = object.__new__(cls)
NameError: name 'cls' is not defined

System information

Hata version: 1.1.101
Platform: Windows-10-10.0.19042-SP0
Python implementation: cpython
Python version: 3.9 final

Make more issues

New contributors don't have anything to work on. So just make some issues which we can contribute to

[Feature request] Allow hdsl in slash command description

Summary

Slash command description should only include the first paragraph of documentation allowing other properties of the function to be documented (for example using hdsl) within it's docstring.

Ideal Solution

Everything after the first double line break should be excluded.

Use case code

@Client.interactions
async def pepe(
    client,
    event,
):
    """
    hello

    Parameters
    ----------
    client : ``Client``
        The client who received the event.
    event : ``InteractionEvent``
        The received interaction event.
    """
    return 'a'

Alternative solutions

Using the description parameter at registration.

Additional Context

No response

Unnecessary event parameters.

Some event handler parameters can be yeeted after fixing up caching.

As an example the guild parameter of channel_delete could be made redundant if channel.guild_id would not be reset to 0 on deletion.

[Bug] unix_time can go out of range on windows

Description

unix_time can go out of range in windows raising OSError instead of the expected ValueError like on linux.

Reproduction Steps

Use windows. (Please don't do that)

Reproduction Code

N/A

Expected behaviour

No exception occurs.

Actual behaviour

Traceback (most recent call last):
  File "...\hata\discord\gateway\client_gateway.py", line 357, in _received_message
    if parser(client, data) is None:
  File "...\hata\discord\events\parsers.py", line 1377, in PRESENCE_UPDATE__OPT
    user._update_presence(data)
  File "...\hata\discord\user\client_user_base.py", line 777, in _update_presence
    new_activities = [create_activity_from_data(activity_data) for activity_data in activity_datas]
  File "...\hata\discord\user\client_user_base.py", line 777, in <listcomp>
    new_activities = [create_activity_from_data(activity_data) for activity_data in activity_datas]
  File "...\hata\discord\activity\utils.py", line 32, in create_activity_from_data
    return activity_type.from_data(activity_data)
  File "...\hata\discord\activity\activity_rich.py", line 365, in from_data
    self._update_attributes(activity_data)
  File "...\hata\discord\activity\activity_rich.py", line 397, in _update_attributes
    created_at = unix_time_to_datetime(created_at)
  File "...\hata\discord\utils.py", line 273, in unix_time_to_datetime
    return datetime.utcfromtimestamp(unix_time)
OSError(22, 'Invalid argument')

System information

Python3.9
windows?

(not my pc)

Extension Folders?

What if I registered a folder then everything made there would be registered too for easier checking and no more looping through a path

Might be a bad idea;
Since I kinda use multiple bots maybe find a way we could separate those? You can set a folder to this bot only.

Cogs

extension files and cogs for the bot.

[SUGGESTION] Add a default help command

I think a default help command (similar to Discord.py's help command) would be a good idea. Maybe just to show users how their help command should be structured? The structure would probably be like

CATEGORY:
  - Command1 <args> - <description>
  - Command2 <args> - <description>

[Bug] Broken plugin dependency tree

Description

After f5012b6 plugin dependency tree broke.

Reproduction Steps

Reload a plugin with dependency tree.

Reproduction Code

No response

Expected behaviour

Everything works like before.

Actual behaviour

No response

System information

dev

[Bug] Cannot use Fosscord with Hata

Description

I'm attempting to use Hata with Fosscord, a reimplementation of the discord API, but currently my program refuses to work correctly due to errors. Here are the errors i have, the first one uses is_bot=False, but the result of the second error keeps is_bot to True

Traceback (most recent call last):
  File "/data/data/com.termux/files/home/hata-foss/main.py", line 18, in <module>
    acc.start()
  File "/data/data/com.termux/files/usr/lib/python3.10/site-packages/hata/discord/client/client.py", line 14797, in start
    return task.sync_wrap().wait()
  File "/data/data/com.termux/files/usr/lib/python3.10/site-packages/scarletio-1.0.5-py3.10.egg/scarletio/core/traps/future_sync_wrapper.py", line 392, in wait
    return self.result()
  File "/data/data/com.termux/files/usr/lib/python3.10/site-packages/scarletio-1.0.5-py3.10.egg/scarletio/core/traps/future_sync_wrapper.py", line 221, in result
    raise exception
  File "/data/data/com.termux/files/usr/lib/python3.10/site-packages/scarletio-1.0.5-py3.10.egg/scarletio/core/traps/task.py", line 480, in _step
    result = coroutine.send(None)
  File "/data/data/com.termux/files/usr/lib/python3.10/site-packages/hata/discord/client/client.py", line 14884, in connect
    await self.client_gateway_reshard()
  File "/data/data/com.termux/files/usr/lib/python3.10/site-packages/hata/discord/client/client.py", line 14685, in client_gateway_reshard
    new_shard_count = data['shards']
KeyError: 'shards'
Unexpected exception occurred at <Client id=920060660405632105 (partial)>._connect
Traceback (most recent call last):
  File "/data/data/com.termux/files/usr/lib/python3.10/site-packages/hata/discord/client/client.py", line 14916, in _connect
    await self.gateway.run()
  File "/data/data/com.termux/files/usr/lib/python3.10/site-packages/hata/discord/gateway/client_gateway.py", line 172, in run
    should_reconnect = await self._poll_event()
  File "/data/data/com.termux/files/usr/lib/python3.10/site-packages/hata/discord/gateway/client_gateway.py", line 292, in _poll_event
    return (await self._received_message(message))
  File "/data/data/com.termux/files/usr/lib/python3.10/site-packages/hata/discord/gateway/client_gateway.py", line 329, in _received_message
    sequence = message['s']
KeyError('s')
If you can reproduce this bug, Please send me a message or open an issue with your code, and with every detail how to reproduce it.
Thanks!

Reproduction Steps

No response

Reproduction Code

from os import environ

environ['HATA_API_ENDPOINT']     = "https://dev.fosscord.com/api/"
environ['HATA_CDN_ENDPOINT']     = "https://cdn.fosscord.com/"
environ['HATA_DISCORD_ENDPOINT'] = "https://dev.fosscord.com/"

from hata import Client

token = "MY TOKEN"

acc = Client(token, is_bot=False)


@acc.events
async def message_create(client, message):
    print(m.author.full_name+': '+m.clean_content)

acc.start()

Expected behaviour

The bot should connect successfully to the gateway

Actual behaviour

It failed to run

System information

Hata version: 1.1.127
Platform: Linux-4.14.180-perf-gaefbc3caa24c-aarch64-with-libc
Python implementation: cpython
Python version: 3.10 final

[Bug] Timestamp?

Description

Traceback (most recent call last):
  File "/storage/emulated/0/Codes/yametechs/dbot/main.py", line 1, in <module>                                             import hata
  File "/data/data/com.termux/files/home/.local/share/virtualenvs/dbot-OSOAGk4U/lib/python3.10/site-packages/hata/__init__.py", line 110, in <module>                                                                                             from .discord import *                                                                                               File "/data/data/com.termux/files/home/.local/share/virtualenvs/dbot-OSOAGk4U/lib/python3.10/site-packages/hata/discord/__init__.py", line 1, in <module>                                                                                       from .activity import *                                                                                             File "/data/data/com.termux/files/home/.local/share/virtualenvs/dbot-OSOAGk4U/lib/python3.10/site-packages/hata/discord/activity/__init__.py", line 3, in <module>                                                                              from .activity_base import *                                                                                         File "/data/data/com.termux/files/home/.local/share/virtualenvs/dbot-OSOAGk4U/lib/python3.10/site-packages/hata/discord/activity/activity_base.py", line 8, in <module>                                                                         from ..utils import DATETIME_FORMAT_CODE, DISCORD_EPOCH_START, datetime_to_unix_time, unix_time_to_datetime          File "/data/data/com.termux/files/home/.local/share/virtualenvs/dbot-OSOAGk4U/lib/python3.10/site-packages/hata/discord/utils.py", line 331, in <module>                                                                                        UNIX_TIME_MAX = datetime_to_unix_time(DATETIME_MAX)                                                                  File "/data/data/com.termux/files/home/.local/share/virtualenvs/dbot-OSOAGk4U/lib/python3.10/site-packages/hata/discord/utils.py", line 299, in datetime_to_unix_time                                                                           return floor(date_time.timestamp() * 1000.0)                                                                       OverflowError: timestamp out of range for platform time_t```

### Reproduction Steps

pipenv install hata
python
>> import hata

### Reproduction Code

```python
import hata

Expected behaviour

imports hata

Actual behaviour

errors

System information

Can't run... it errors

[Bug] No nonce support for webhook_message_create

Description

Nonce doesn't have an attribute for webhooks, and despite my own testing of modified source code (where I've edited nonce into the parameters and added it to the message payload), it doesn't set the nonce for the message. I do not know the cause of this.

Reproduction Steps

Just send a message to a webhook with nonce, I'll upload a fork of Hata that has nonce added to the webhook parameter

Reproduction Code

await client.webhook_message_create(webhook, "Message", nonce="X")

Expected behaviour

I expected that nonce should be a valid parameter and should be accessible from other events that return messages (e.g. message_edit)

Actual behaviour

Original Hata code has no support, my modified Hata fork doesn't register nonce despite it being added to the message payload

System information

Hata version: 1.1.127
Platform: Linux-4.14.180-perf-gaefbc3caa24c-aarch64-with-libc
Python implementation: cpython
Python version: 3.10 final

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.