mirror of
https://github.com/brandons209/Red-bot-Cogs.git
synced 2024-06-29 19:40:19 +12:00
fix config write
This commit is contained in:
parent
88eb4b4f1c
commit
9b193228e6
|
@ -78,12 +78,12 @@ class ScriptCog:
|
||||||
if os.path.isfile("data/scriptcog/config.txt"):
|
if os.path.isfile("data/scriptcog/config.txt"):
|
||||||
with open("data/scriptcog/config.txt", "r") as f:
|
with open("data/scriptcog/config.txt", "r") as f:
|
||||||
content = f.read()
|
content = f.read()
|
||||||
content = content.split("\n")
|
content = content.split()
|
||||||
self.word_limit = int(content[0])
|
self.word_limit = int(content[0])
|
||||||
self.cooldown_limit = int(content[1])
|
self.cooldown_limit = int(content[1])
|
||||||
else:
|
else:
|
||||||
with open("data/scriptcog/config.txt", "w") as f:
|
with open("data/scriptcog/config.txt", "w") as f:
|
||||||
f.write("100\n30")
|
f.write("100 30")
|
||||||
self.word_limit = 100
|
self.word_limit = 100
|
||||||
self.cooldown_limit = 30
|
self.cooldown_limit = 30
|
||||||
|
|
||||||
|
@ -98,7 +98,7 @@ class ScriptCog:
|
||||||
|
|
||||||
def _write_config(self):
|
def _write_config(self):
|
||||||
with open("data/scriptcog/config.txt", "w") as f:
|
with open("data/scriptcog/config.txt", "w") as f:
|
||||||
f.write("{}\n{}".format(self.word_limit, self.cooldown_limit))
|
f.write("{} {}".format(self.word_limit, self.cooldown_limit))
|
||||||
|
|
||||||
@commands.command(pass_context=True, no_pm=True)
|
@commands.command(pass_context=True, no_pm=True)
|
||||||
async def setwordlimit(self, ctx, num_words : int = 100):
|
async def setwordlimit(self, ctx, num_words : int = 100):
|
||||||
|
|
Loading…
Reference in a new issue