Skip to main content

A Python Discord Interaction bot API wrapper.

Project description

httpcord

A Python Discord Interaction bot API wrapper.

From examples/hello-world.py

from httpcord import HTTPBot, CommandResponse, Interaction
from httpcord.enums import InteractionResponseType

CLIENT_ID = 0000000000000000000000
CLIENT_PUBLIC_KEY = "..."
CLIENT_TOKEN = "..."

bot = HTTPBot(
    client_id=CLIENT_ID,
    client_public_key=CLIENT_PUBLIC_KEY,
    register_commands_on_startup=True,
)

@bot.command("hello-world")
async def hello_world(interaction: Interaction) -> CommandResponse:
    return CommandResponse(
        type=InteractionResponseType.CHANNEL_MESSAGE_WITH_SOURCE,
        content=f"hello, {interaction.user.mention}! You joined this server at <t:{int(interaction.user.joined_at.timestamp())}:F>.",
    )

bot.start(CLIENT_TOKEN)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

httpcord-0.0.2.tar.gz (5.6 kB view details)

Uploaded Source

Built Distribution

httpcord-0.0.2-py3-none-any.whl (8.0 kB view details)

Uploaded Python 3

File details

Details for the file httpcord-0.0.2.tar.gz.

File metadata

  • Download URL: httpcord-0.0.2.tar.gz
  • Upload date:
  • Size: 5.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.11

File hashes

Hashes for httpcord-0.0.2.tar.gz
Algorithm Hash digest
SHA256 305446c3f64b5ac27fbd8999ca172d8d1b1254dda21793273a0902783eaaa55d
MD5 f0ac85b02e88d16e9aaa07c936435349
BLAKE2b-256 d09f867a7eabbd3f4518251a7005366988bb1df815efbbfffeb04b899f504d1a

See more details on using hashes here.

File details

Details for the file httpcord-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: httpcord-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 8.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.11

File hashes

Hashes for httpcord-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 8a0628bc8281789ad704aa44f64c31eb8cdb2ef33cc7719441498fc196bc1376
MD5 9aad1d66c13ba1b323aa1a6cfc55c8c1
BLAKE2b-256 1ca1b5251a4e5e71dcc825e8e1d5c5e3e3e74f258184fb43daa8caca55973fef

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page