Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # https://www.thecodeship.com/patterns/guide-to-python-function-decorators/
- # https://pastebin.com/ba3tzQD9
- from typing import Any
- import os
- from twitchio.ext import commands
- import asyncio
- # set up the bot
- bot = commands.Bot(
- irc_token=os.environ['TMI_TOKEN'],
- client_id=os.environ['CLIENT_ID'],
- nick=os.environ['BOT_NICK'],
- prefix=os.environ['BOT_PREFIX'],
- initial_channels=[os.environ['CHANNEL']]
- )
- @bot.event
- async def event_ready():
- 'Called once when the bot goes online.'
- print(f"{os.environ['BOT_NICK']} ist online!")
- ws = bot._ws # this is only needed to send messages within event_ready
- await ws.send_privmsg(os.environ['CHANNEL'], f"/me ist online!")
- @bot.event
- async def event_message(ctx):
- 'Runs every time a message is sent in chat.'
- # make sure the bot ignores itself and the streamer
- # if ctx.author.name.lower() == os.environ['BOT_NICK'].lower():
- # return
- await bot.handle_commands(ctx)
- # await ctx.channel.send(ctx.content)
- if 'hallo' in ctx.content.lower():
- await ctx.channel.send(f"Guten Tag, @{ctx.author.name}!")
- if 'cs' in ctx.content.lower():
- await ctx.channel.send(f" 2.if")
- if 'hi' in ctx.content.lower():
- test(ctx.test)
- @bot.command(name='test')
- async def test(ctx):
- print('test')
- @bot.command(name='bsg')
- async def bsg(ctx):
- await ctx.send(f" @{ctx.author.name} [Backseatgaming] - Beschreibt im allgemeinen jemanden, der aus der zweiten "
- f"Reihe (Backseat), "
- f"dem Spieler sagt was er machen soll, sowie den Spieler daran zu Erinnern, wenn er etwas "
- f"vergessen hat. - Der Ingame Charakter kennt kein Twitch und hat keine 200 Stimmen im Kopf, "
- f"die ihm sagen was er machen soll!")
- print('bsg')
- @bot.command(name='zeit')
- async def zeit(ctx):
- await ctx.send('Der 24h Stream läuft noch bis 14Uhr')
- print('zeit')
- if __name__ == "__main__":
- bot.run()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement