Skip to main content

Asynchonous wrapper for twitch IRC3

Project description

AsyncTwitch
=======================

This library is used to asynchronously interact with twitch chat.

----

Requirements:

- Create a twitch.tv account
- Get an Oauth token

----

How to use:

```python
import asynctwitch

# Use the pre-made CommandBot, to handle messages yourself, use asynctwitch.Bot and handle event_message.
bot = asynctwitch.CommandBot(
user = "Your_bot_twitch_username",
oauth = "Your_twitch_oauth_token", # oauth:1234567890abcdefghijklmnopqrst
channel = "channel_name", # Defaults to Twitch
prefix = "your_prefix_here", # Defaults to '!'
)



# Example command:
@bot.command('example', alias=['moreexample','anothaone'], desc='example command')
async def example(message, word1:str, number1:int, rest:str):
bot.say('wow')



# Example subcommand:
@bot.command('say')
async def say(m, subcommand:str):
pass

@say.subcommand('this')
async def this(m):
bot.say("that")

bot.start()
```

To use a config file instead, use
```python
asynctwitch.Bot(config="your_settings.ini")
# or
asynctwitch.CommandBot(config="your_settings.ini")
```
see config.ini for an example file


It's also possible to handle messages your own way, just use

```python
@bot.override
async def event_message(message):
# your handling here
```

The same applies to all bot.event_X functions.


To use `await bot.play_file('file.mp3')`, ffprobe, ffmpeg and ffplay have to be installed. They can be found on the ffmpeg website.

To use `await bot.play_ytdl('song')`, youtube_dl has to be installed. Use `pip install youtube_dl` to install it.
You will also need the requirements for `bot.play_file`


These examples use the `async/await` syntax added in python 3.5, to use this code in 3.4 use `@asyncio.coroutine` and `yield from` instead.
THIS DOES NOT WORK WITH PYTHON VERSIONS BELOW 3.4!


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

asynctwitch-4.1.1.tar.gz (14.9 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

asynctwitch-4.1.1-py3.6.egg (37.1 kB view details)

Uploaded Egg

asynctwitch-4.1.1-py3-none-any.whl (17.6 kB view details)

Uploaded Python 3

File details

Details for the file asynctwitch-4.1.1.tar.gz.

File metadata

  • Download URL: asynctwitch-4.1.1.tar.gz
  • Upload date:
  • Size: 14.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for asynctwitch-4.1.1.tar.gz
Algorithm Hash digest
SHA256 d86c28cada1a6ae1613f21e8e57930de5134c631baaad03bd689aa493f76f86e
MD5 4b1a6e0e370dd17c40100e8cb5eae0dd
BLAKE2b-256 7465777fd32bd2e4051ee6940dfd0b595c811390613f5a96c3c55d8196c736a9

See more details on using hashes here.

File details

Details for the file asynctwitch-4.1.1-py3.6.egg.

File metadata

File hashes

Hashes for asynctwitch-4.1.1-py3.6.egg
Algorithm Hash digest
SHA256 88b63eb28d9494ba31c38604b440fbb4fdedc2a41860a2a4995023eea2769700
MD5 8eba16809113cda56fda71eeadd0edfa
BLAKE2b-256 c2d9cddd436c7116b49ace8cd137d85671c83db2760666d2165e7fe48dd4b6fc

See more details on using hashes here.

File details

Details for the file asynctwitch-4.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for asynctwitch-4.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1cbf06f8f45e62815eab684be2ce05afb1aa92211bda6a09e1465e04cdb9cf91
MD5 e769f2344fa190ab63fab549ca9cd0b6
BLAKE2b-256 e76d2fa8c5b4f0798477b166ec064d8f5b43de095cd01048959c427b0e58f518

See more details on using hashes here.

Supported by

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