This commit is contained in:
2026-01-25 19:11:55 +05:00
parent 2ceed8c317
commit b6f914f07a
2 changed files with 8 additions and 3 deletions

1
.env
View File

@@ -1,2 +1,3 @@
PREFIX= PREFIX=
TOKEN= TOKEN=
PROXY=

10
main.py
View File

@@ -19,14 +19,17 @@ class getcfg:
print("Maybe you didn't setup your .env file") print("Maybe you didn't setup your .env file")
sys.exit(0) sys.exit(0)
self.prefix = os.getenv('PREFIX') self.prefix = os.getenv('PREFIX')
self.proxy = os.getenv('PROXY')
def getprefix(self): def getprefix(self):
return self.prefix return self.prefix
def gettoken(self): def gettoken(self):
return self.token return self.token
def getproxy(self):
return self.proxy
class Bot(commands.Bot): class Bot(commands.Bot):
def __init__(self): def __init__(self):
self.conwarn = sqlite3.connect("warn.db") self.conwarn = sqlite3.connect("warn.db")
@@ -36,6 +39,7 @@ class Bot(commands.Bot):
super().__init__( super().__init__(
command_prefix=self.getcfg.getprefix(), command_prefix=self.getcfg.getprefix(),
intents=discord.Intents.all(), intents=discord.Intents.all(),
proxy=self.getcfg.getproxy(),
) )
@@ -81,6 +85,6 @@ class Bot(commands.Bot):
self.confmsg.commit() self.confmsg.commit()
await self.load() await self.load()
await self.start(token=self.getcfg.gettoken()) await self.start(token=self.getcfg.gettoken())
bot = Bot() bot = Bot()
asyncio.run(bot.main()) asyncio.run(bot.main())