add config
This commit is contained in:
parent
29afa742ff
commit
758af39da0
8
config.ini
Normal file
8
config.ini
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
[Bot]
|
||||||
|
Token=
|
||||||
|
Status=
|
||||||
|
|
||||||
|
[Channels]
|
||||||
|
MemberLogs =
|
||||||
|
ModLogs =
|
||||||
|
Skynet =
|
12
configmanager.py
Normal file
12
configmanager.py
Normal 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
|
|
@ -1,17 +1,22 @@
|
||||||
import discord
|
import discord
|
||||||
from discord.ext import commands
|
from discord.ext import commands
|
||||||
|
import logging
|
||||||
|
from configmanager import ConfigManager
|
||||||
|
|
||||||
intents = discord.Intents.default()
|
intents = discord.Intents.default()
|
||||||
intents.members = True
|
intents.members = True
|
||||||
|
|
||||||
bot = discord.Bot(intents=intents)
|
bot = discord.Bot(intents=intents)
|
||||||
|
setting = ConfigManager.read_config()
|
||||||
|
token = setting['Bot']['Token']
|
||||||
|
logger = logging.getLogger()
|
||||||
|
|
||||||
class Kiafumi(discord.Bot):
|
class Kiafumi(discord.Bot):
|
||||||
@bot.event
|
@bot.event
|
||||||
async def on_ready():
|
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']:
|
for ext in ['commands.fun', 'commands.moderation']:
|
||||||
bot.load_extension(ext)
|
bot.load_extension(ext)
|
||||||
|
|
||||||
bot.run("") # token
|
bot.run(token) # token
|
Loading…
Reference in a new issue