Giter Site home page Giter Site logo

ccg-twitch-bot's Introduction

Twitch Chat Logger

Here's Courtesy Call Gaming's repo for their Twitch Chat Logger

Getting Started

Prerequisites

  • Python 3.7
  • git
  • setproctitle -> python -m pip install setproctitle
  • twitchio -> python -m pip install twitchio
  • twitchio -> python -m pip install python-dotenv
  • pwntools -> python -m pip install --upgrade git+https://github.com/Gallopsled/pwntools.git@dev
  • oauth token & client-id for a Twitch account for your bot

Installing

  1. Clone the repo or unzip it somewhere
  2. Open up a console window and navigate to the directory you cloned(unzipped) it in
  3. Install requirements
  4. Pop in all your secrets into the respective areas in .env
  5. Back to the console, python logger.py to start the bot
  6. Type !test in the chatroom to test the bot's working

Usage

To run the chatbot, you will need to provide an OAuth access token with the chat_login scope. You can reference an authentication sample to accomplish this, or simply use the Twitch Chat OAuth Password Generator.

$ python logger.py [channel]
  • Channel - [OPTIONAL if set in .env] The channel your bot will connect to

Bot Interaction

Right now, you can only interact with the bot via the single command, !test. You can create similar commands pretty easily, just copy the function and change out the function name decorator arguement...

@bot.command(name='likethis', aliases=['this'])
async def likethis(ctx):
    await ctx.send(f'ZoeS17, @{ctx.author.name}!')

Events

There are 2 events that are used in the code right now.. event_ready and event_message.

event_ready

This executes when the bot comes online, and will print out to the console.

@bot.event
async def event_ready():
    print(f'Ready | {bot.nick}')

event_message

This function executes once per event (or message) sent. You can make it handle input from chat that aren't necesarily commands, and fun stuff like that.

@bot.event
async def event_message(message):
    print(message.content)
    await bot.handle_commands(message)

You can find more info in TwitchIO's official documentation.

ccg-twitch-bot's People

Contributors

zoes17 avatar

Watchers

 avatar

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.