add config

This commit is contained in:
Anya 2022-03-07 18:37:07 -08:00
parent 29afa742ff
commit 758af39da0
3 changed files with 27 additions and 2 deletions

8
config.ini Normal file
View file

@ -0,0 +1,8 @@
[Bot]
Token=
Status=
[Channels]
MemberLogs =
ModLogs =
Skynet =

12
configmanager.py Normal file
View file

@ -0,0 +1,12 @@
import configparser
class ConfigManager():
def read_config():
config = configparser.ConfigParser()
config.read('config.ini')
return config
def write_config():
config = configparser.ConfigParser()
config.read('config.ini')
return config

View file

@ -1,17 +1,22 @@
import discord
from discord.ext import commands
import logging
from configmanager import ConfigManager
intents = discord.Intents.default()
intents.members = True
bot = discord.Bot(intents=intents)
setting = ConfigManager.read_config()
token = setting['Bot']['Token']
logger = logging.getLogger()
class Kiafumi(discord.Bot):
@bot.event
async def on_ready():
print(f'Logged on as {bot.user}!')
logger.info(f'Logged on as {bot.user}!')
for ext in ['commands.fun', 'commands.moderation']:
bot.load_extension(ext)
bot.run("") # token
bot.run(token) # token