Skip to main content

A Fosscord API Wrapper for Userbots/Selfbots written in Python.

Project description

fossbotpy

version python versions
A simple, easy to use, non-restrictive, synchronous fossbotpy API Wrapper for Selfbots/Userbots written in Python.
-using requests and websockets :)

Table of Contents

Key features

  • easy-to-use (make selfbots/userbots)
  • easy-to-extend/edit (add api wrappers)
  • readable (organized 😃 )
  • mimics the client while giving you control
  • on-event (gateway) capabilities
  • op14 and op8 member fetching
  • support for python 2.7

Installation

Python 2.7 or higher required

# Linux/macOS
python3 -m pip install -U fossbotpy

# Windows
py -3 -m pip install -U fossbotpy

Prerequisites (installed automatically using above methods)

  • requests
  • requests_toolbelt
  • brotli
  • websocket_client==0.59.0
  • filetype
  • ua-parser
  • random_user_agent
  • colorama

Contributing

Contributions are welcome. You can submit issues, make pull requests, or suggest features.
Please see the contribution guidelines

Quick example

import fossbotpy
token = 'token'
base_url = 'https://dev.fosscord.com/api/v9/'
bot = fossbotpy.Client(token=token, base_url=base_url, log={"console":True, "file":False})

bot.sendMessage("238323948859439", "Hello :)")

@bot.gateway.command
def helloworld(resp):
    if resp.event.ready:
        user = bot.gateway.session.user
        print("Logged in as {}#{}".format(user['username'], user['discriminator']))
    if resp.event.message:
        m = resp.parsed.auto()
        guildID = m.get('guild_id') #dms do not have a guild_id
        channelID = m['channel_id']
        username = m['author']['username']
        discriminator = m['author']['discriminator']
        content = m['content']
        print("> guild {} channel {} | {}#{}: {}".format(guildID, channelID, username, discriminator, content))

bot.gateway.run()

Links

Documentation
More examples
Changelog
Source
PyPi

Checklist

  • Sending basic text messages
  • Sending Images
  • Sending Embeds
  • Sending Requests (Friends etc)
  • Profile Editing (Name,Status,Avatar)
  • On-Message (and other on-anything gateway) capabilities
  • Getting guild members
  • improve documentation
  • add interactions (slash command triggering, buttons, and dropdowns/menus)
  • add more guild http api wraps
  • media (voice & video calls, along with the various discord games/activites)
  • Everything

FAQ

Q: How to fix "[SSL: CERTIFICATE_VERIFY_FAILED]" errors?
A: https://stackoverflow.com/a/53310545/14776493

Q: import _brotli ImportError: DLL load failed: The specified module could not be found. How to fix?
A: https://github.com/google/brotli/issues/782

Q: The owner of this website (discord.com) has banned your access based on your browser's signature.... How to fix?
A: This is because of your user agent (https://stackoverflow.com/a/24914742/14776493). Either try again or reinitialize your client with a new user agent.

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

fossbotpy-0.0.1.tar.gz (64.2 kB view hashes)

Uploaded source

Built Distribution

fossbotpy-0.0.1-py3-none-any.whl (79.0 kB view hashes)

Uploaded py3

Supported by

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