No comment

I don't want to talk about this
This commit is contained in:
Twentysix 2016-02-11 14:37:32 +01:00
parent 885139cb9f
commit 6518c6b8d8
2 changed files with 11 additions and 18 deletions

View File

@ -12,14 +12,11 @@ import glob
import re import re
import aiohttp import aiohttp
from bs4 import BeautifulSoup from bs4 import BeautifulSoup
import __main__
import json import json
if not discord.opus.is_loaded(): if not discord.opus.is_loaded():
discord.opus.load_opus('libopus-0.dll') discord.opus.load_opus('libopus-0.dll')
main_path = os.path.dirname(os.path.realpath(__main__.__file__))
youtube_dl_options = { youtube_dl_options = {
'format': 'bestaudio/best', 'format': 'bestaudio/best',
'extractaudio': True, 'extractaudio': True,
@ -344,14 +341,14 @@ class Audio:
else: else:
await self.bot.say("Queue status can be either on or off.") await self.bot.say("Queue status can be either on or off.")
return return
fileIO(main_path + "/data/audio/settings.json", "save", self.settings) fileIO("data/audio/settings.json", "save", self.settings)
@audioset.command() @audioset.command()
async def maxlength(self, length : int): async def maxlength(self, length : int):
"""Maximum track length for requested links""" """Maximum track length for requested links"""
self.settings["MAX_LENGTH"] = length self.settings["MAX_LENGTH"] = length
await self.bot.say("Maximum length is now " + str(length) + " seconds.") await self.bot.say("Maximum length is now " + str(length) + " seconds.")
fileIO(main_path + "/data/audio/settings.json", "save", self.settings) fileIO("data/audio/settings.json", "save", self.settings)
@audioset.command() @audioset.command()
async def volume(self, level : float): async def volume(self, level : float):
@ -359,7 +356,7 @@ class Audio:
if level >= 0 and level <= 1: if level >= 0 and level <= 1:
self.settings["VOLUME"] = level self.settings["VOLUME"] = level
await self.bot.say("Volume is now set at " + str(level) + ". It will take effect after the current track.") await self.bot.say("Volume is now set at " + str(level) + ". It will take effect after the current track.")
fileIO(main_path + "/data/audio/settings.json", "save", self.settings) fileIO("data/audio/settings.json", "save", self.settings)
else: else:
await self.bot.say("Volume must be between 0 and 1. Example: 0.40") await self.bot.say("Volume must be between 0 and 1. Example: 0.40")
@ -589,16 +586,16 @@ def check_files():
settings = {"VOLUME" : 0.5, "MAX_LENGTH" : 3700, "QUEUE_MODE" : True} settings = {"VOLUME" : 0.5, "MAX_LENGTH" : 3700, "QUEUE_MODE" : True}
if not os.path.isfile(main_path + "/data/audio/settings.json"): if not os.path.isfile("data/audio/settings.json"):
print("Creating default audio settings.json...") print("Creating default audio settings.json...")
fileIO(main_path + "/data/audio/settings.json", "save", settings) fileIO("data/audio/settings.json", "save", settings)
allowed = ["^(https:\/\/www\\.youtube\\.com\/watch\\?v=...........*)", "^(https:\/\/youtu.be\/...........*)", allowed = ["^(https:\/\/www\\.youtube\\.com\/watch\\?v=...........*)", "^(https:\/\/youtu.be\/...........*)",
"^(https:\/\/youtube\\.com\/watch\\?v=...........*)", "^(https:\/\/soundcloud\\.com\/.*)"] "^(https:\/\/youtube\\.com\/watch\\?v=...........*)", "^(https:\/\/soundcloud\\.com\/.*)"]
if not os.path.isfile(main_path + "/data/audio/accepted_links.json"): if not os.path.isfile("data/audio/accepted_links.json"):
print("Creating accepted_links.json...") print("Creating accepted_links.json...")
fileIO(main_path + "/data/audio/accepted_links.json", "save", allowed) fileIO("data/audio/accepted_links.json", "save", allowed)
def setup(bot): def setup(bot):
check_folders() check_folders()

View File

@ -5,9 +5,6 @@ from .utils import checks
from random import randint from random import randint
import os import os
import time import time
import __main__
main_path = os.path.dirname(os.path.realpath(__main__.__file__))
slot_payouts = """Slot machine payouts: slot_payouts = """Slot machine payouts:
:two: :two: :six: Bet * 5000 :two: :two: :six: Bet * 5000
@ -19,7 +16,6 @@ slot_payouts = """Slot machine payouts:
Three symbols: +500 Three symbols: +500
Two symbols: Bet * 2""" Two symbols: Bet * 2"""
class Economy: class Economy:
"""Economy """Economy
@ -154,28 +150,28 @@ class Economy:
"""Minimum slot machine bid""" """Minimum slot machine bid"""
self.settings["SLOT_MIN"] = bid self.settings["SLOT_MIN"] = bid
await self.bot.say("Minimum bid is now " + str(bid) + " credits.") await self.bot.say("Minimum bid is now " + str(bid) + " credits.")
fileIO(main_path + "/data/economy/settings.json", "save", self.settings) fileIO("data/economy/settings.json", "save", self.settings)
@economyset.command() @economyset.command()
async def slotmax(self, bid : int): async def slotmax(self, bid : int):
"""Maximum slot machine bid""" """Maximum slot machine bid"""
self.settings["SLOT_MAX"] = bid self.settings["SLOT_MAX"] = bid
await self.bot.say("Maximum bid is now " + str(bid) + " credits.") await self.bot.say("Maximum bid is now " + str(bid) + " credits.")
fileIO(main_path + "/data/economy/settings.json", "save", self.settings) fileIO("data/economy/settings.json", "save", self.settings)
@economyset.command() @economyset.command()
async def paydaytime(self, seconds : int): async def paydaytime(self, seconds : int):
"""Seconds between each payday""" """Seconds between each payday"""
self.settings["PAYDAY_TIME"] = seconds self.settings["PAYDAY_TIME"] = seconds
await self.bot.say("Value modified. At least " + str(seconds) + " seconds must pass between each payday.") await self.bot.say("Value modified. At least " + str(seconds) + " seconds must pass between each payday.")
fileIO(main_path + "/data/economy/settings.json", "save", self.settings) fileIO("data/economy/settings.json", "save", self.settings)
@economyset.command() @economyset.command()
async def paydaycredits(self, credits : int): async def paydaycredits(self, credits : int):
"""Credits earned each payday""" """Credits earned each payday"""
self.settings["PAYDAY_CREDITS"] = credits self.settings["PAYDAY_CREDITS"] = credits
await self.bot.say("Every payday will now give " + str(credits) + " credits.") await self.bot.say("Every payday will now give " + str(credits) + " credits.")
fileIO(main_path + "/data/economy/settings.json", "save", self.settings) fileIO("data/economy/settings.json", "save", self.settings)
def account_check(self, id): def account_check(self, id):
if id in self.bank: if id in self.bank: