Advertisement
Guest User

Untitled

a guest
May 21st, 2019
205
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.94 KB | None | 0 0
  1.  
  2. from twitchio.ext import commands
  3.  
  4.  
  5. class Bot(commands.Bot):
  6.  
  7.     def __init__(self):
  8.         super().__init__(irc_token='XXXX', client_id='...', nick='corpstache', prefix='^',
  9.                          initial_channels=['acreium'])
  10.  
  11.     # Events don't need decorators when subclassed
  12.     async def event_ready(self):
  13.         print(f'Ready | {self.nick}')
  14.  
  15.     async def event_message(self, message):
  16.         print(message.content)
  17.         await self.handle_commands(message)
  18.  
  19.     # Commands use a different decorator
  20.     @commands.command(name='a')
  21.     async def a(self, ctx):
  22.         await ctx.send(f'Hello {ctx.author.name}!')
  23.     @commands.command(name='slow')
  24.     async def slowI(self, ctx):
  25.         if ctx.author.is_mod == True:
  26.             await ctx.slow()
  27.     @commands.command(name='sloff')
  28.     async def slowO(self, ctx):
  29.         if ctx.author.is_mod == True:
  30.             await ctx.slow_off()
  31.  
  32.  
  33. bot = Bot()
  34. bot.run()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement