bot
This commit is contained in:
parent
ee94cccb7d
commit
b676579e7d
92
froge.py
Normal file
92
froge.py
Normal file
@ -0,0 +1,92 @@
|
|||||||
|
import os
|
||||||
|
import json
|
||||||
|
from twitchio.ext import commands
|
||||||
|
|
||||||
|
authConfig = None
|
||||||
|
|
||||||
|
authConfigFileName = 'froge.json'
|
||||||
|
generalConfigFileName = 'general.json'
|
||||||
|
|
||||||
|
########## HELPER FUNCTIONS ##########
|
||||||
|
def ReadAuthConfig():
|
||||||
|
with open (authConfigFileName, 'r') as file:
|
||||||
|
global authConfig
|
||||||
|
authConfig = json.load(file)
|
||||||
|
|
||||||
|
def ReadGeneralConfig():
|
||||||
|
with open (generalConfigFileName, 'r') as file:
|
||||||
|
global generalConfig
|
||||||
|
generalConfig = json.load(file)
|
||||||
|
|
||||||
|
def GetTmiToken():
|
||||||
|
ReadAuthConfig()
|
||||||
|
global authConfig
|
||||||
|
if authConfig != None:
|
||||||
|
return authConfig['TMI_TOKEN']
|
||||||
|
|
||||||
|
def GetClientId():
|
||||||
|
ReadAuthConfig()
|
||||||
|
global authConfig
|
||||||
|
if authConfig != None:
|
||||||
|
return authConfig['CLIENT_ID']
|
||||||
|
|
||||||
|
def GetBotNick():
|
||||||
|
ReadAuthConfig()
|
||||||
|
global authConfig
|
||||||
|
if authConfig != None:
|
||||||
|
return authConfig['BOT_NICK']
|
||||||
|
|
||||||
|
def GetBotCommandPrefix():
|
||||||
|
ReadAuthConfig()
|
||||||
|
global authConfig
|
||||||
|
if authConfig != None:
|
||||||
|
return authConfig['BOT_PREFIX']
|
||||||
|
|
||||||
|
def GetBotChannel():
|
||||||
|
ReadAuthConfig()
|
||||||
|
global authConfig
|
||||||
|
if authConfig != None:
|
||||||
|
return authConfig['CHANNEL']
|
||||||
|
|
||||||
|
def GetClientSecret():
|
||||||
|
ReadAuthConfig()
|
||||||
|
global authConfig
|
||||||
|
if authConfig != None:
|
||||||
|
return authConfig['CLIENT_SECRET']
|
||||||
|
|
||||||
|
########## HELPER FUNCTIONS END ##########
|
||||||
|
|
||||||
|
class Bot(commands.Bot):
|
||||||
|
def __init__(self):
|
||||||
|
super().__init__(token=GetTmiToken(),
|
||||||
|
prefix=GetBotCommandPrefix(),
|
||||||
|
initial_channels=[GetBotChannel()])
|
||||||
|
|
||||||
|
async def event_ready(self): # Console confirmation the bot is actually alive >:)
|
||||||
|
print(f'Logged in as {self.nick}')
|
||||||
|
print(f'User id is {self.user_id}')
|
||||||
|
|
||||||
|
### COMMANDS ###
|
||||||
|
@commands.command() # !hello
|
||||||
|
async def hello(self, ctx: commands.Context):
|
||||||
|
await ctx.send(f'Hello {ctx.author.name}')
|
||||||
|
|
||||||
|
@commands.command() # !socials
|
||||||
|
async def socials(self, ctx: commands.Context):
|
||||||
|
await ctx.send(f"")
|
||||||
|
|
||||||
|
@commands.command() # !clip [optional: time] (default: 30 seconds)
|
||||||
|
async def clip(self, ctx: commands.Context, time='30s'):
|
||||||
|
await self.create
|
||||||
|
await ctx.send(' ')
|
||||||
|
|
||||||
|
@commands.command() # !discord
|
||||||
|
async def discord(self, ctx: commands.Context):
|
||||||
|
await ctx.send(' ')
|
||||||
|
|
||||||
|
@commands.command() # !timer {time}
|
||||||
|
async def timer(self, ctx: commands.Context):
|
||||||
|
await ctx.send(' ')
|
||||||
|
|
||||||
|
bot = Bot()
|
||||||
|
bot.run()
|
Loading…
Reference in New Issue
Block a user