# REMEMBER TO UNCOMMENT THE GSS LINE, ROXIE | # REMEMBER TO UNCOMMENT THE GSS LINE, ROXIE | ||||
# DO NOT UNCOMMENT GSS IF YOU ARE NOT ROXIE | |||||
cogs = [ | cogs = [ | ||||
"roxbot.cogs.admin", | "roxbot.cogs.admin", | ||||
print(server) | print(server) | ||||
print("") | print("") | ||||
# In the next two functions, I was gunna user bot.settings for something but I don't think it's possible. | |||||
# So while I don't use it, the function still will do their jobs of adding and removing the settings. | |||||
@bot.event | @bot.event | ||||
async def on_guild_join(guild): | async def on_guild_join(guild): | ||||
async def on_message(message): | async def on_message(message): | ||||
""" | """ | ||||
Checks if the user is blacklisted, if not, process the message for commands as usual. | Checks if the user is blacklisted, if not, process the message for commands as usual. | ||||
:param message: | |||||
:return: | |||||
""" | """ | ||||
if roxbot.blacklisted(message.author): | if roxbot.blacklisted(message.author): | ||||
return | return | ||||
@bot.command() | @bot.command() | ||||
async def about(ctx): | async def about(ctx): | ||||
""" | """ | ||||
Outputs info about RoxBot, showing uptime, how to report issues, what settings where set in prefs.ini and credits. | |||||
Outputs info about RoxBot, showing up time, how to report issues, what settings where set in prefs.ini and credits. | |||||
""" | """ | ||||
owner = bot.get_user(roxbot.owner) | owner = bot.get_user(roxbot.owner) | ||||
em = discord.Embed(title="About Roxbot", colour=roxbot.EmbedColours.pink, description=roxbot.__description__) | em = discord.Embed(title="About Roxbot", colour=roxbot.EmbedColours.pink, description=roxbot.__description__) |
Command_Prefix=r; | Command_Prefix=r; | ||||
[Tokens] | [Tokens] | ||||
; Discord: REQUIRED | |||||
; Imgur: Used in the reddit cog. This is your Client ID | |||||
; Explaination: | |||||
; Discord: This is the Token given when you register your bot account. (REQUIRED) | |||||
; Imgur: Used in the reddit cog. This is your Client ID, given when you register a client with Imgur. | |||||
; Tastsumaki: Only used by custom GSSP cog. Normal users can ignore. | ; Tastsumaki: Only used by custom GSSP cog. Normal users can ignore. | ||||
Discord=TokenHere | Discord=TokenHere | ||||
Imgur=TokenHere | Imgur=TokenHere | ||||
Tatsumaki=TokenHere | |||||
Tatsumaki=TokenHere | |||||
[Backups] | |||||
; Settings for the servers.json backups. | |||||
; This is the file that contains all settings for all servers the bot is in. | |||||
; Explaintion: | |||||
; enabled: Whether or not backups should be enabled. This is heavily recommened to be kept on. | |||||
; rate: The amount of time in seconds that the bot will check for changes in the settings file to backup. Default: 300 # 5 Minutes | |||||
enabled=True | |||||
rate=300 |
import os | |||||
import sys | |||||
import configparser | |||||
# Version Checking | |||||
# Basically reject anything not 3.5 or 3.6 as those are the only versions that work. | |||||
if not sys.version_info[:2] == (3, 5) or sys.version_info[:2] == (3, 6): | |||||
print("Roxbot does not support Python {}".format(".".join(sys.version_info[:2]))) | |||||
exit(0) | |||||
# Install Requirements | |||||
code = os.system("python3 -m pip install -r requirements.txt") | |||||
if code != 0: | |||||
print("Error occurred while installing requirements. Exiting...") | |||||
exit(1) | |||||
else: | |||||
print("Requirements successfully installed.") | |||||
# Create preferences file. | |||||
with open("roxbot/settings/preferences_example.ini", "r") as orig: | |||||
fp = orig.read() | |||||
with open("roxbot/settings/preferences.ini", "w") as new: | |||||
new.write(fp) | |||||
print("Preferences file created") | |||||
# Ask to do preferences.ini setup | |||||
print("Most of the setup is complete. All there is to do is setup the preferences.ini file.") | |||||
print("You can do the quick setup in this script, or manually setup the file yourself.") | |||||
while True: | |||||
choice = input("Do you want to continue to the easy preferences setup? (y/n): ") | |||||
if choice.strip(" ").lower() == "y": | |||||
print("You can leave the field empty if you don't have the required thing.") | |||||
print("Note: Everything that is asked here is required and not having it can lead ot issues.") | |||||
break | |||||
elif choice.strip(" ").lower() == "n": | |||||
print("Exiting...") | |||||
exit(0) | |||||
# Preferences.ini setup | |||||
config = configparser.ConfigParser() | |||||
config.read("roxbot/settings/preferences.ini") | |||||
print("Setting up preferences file...") | |||||
owner_id = str(input("Bot Owner ID: ")).strip(" ") | |||||
if not owner_id or not owner_id.isdigit(): | |||||
print("Invalid owner ID given. Skipping...") | |||||
else: | |||||
config["Roxbot"]["OwnerID"] = owner_id | |||||
prefix = str(input("Command Prefix: ")).strip(" ") | |||||
if not prefix: | |||||
print("Invalid Owner ID given. Skipping...") | |||||
else: | |||||
config["Roxbot"]["Command_Prefix"] = prefix | |||||
token = str(input("Discord Bot Token: ")).strip(" ") | |||||
if not token: | |||||
print("Invalid token given. Skipping...") | |||||
else: | |||||
config["Tokens"]["Discord"] = token | |||||
token = str(input("Imgur Client ID: ")).strip(" ") | |||||
if not token: | |||||
print("Invalid client ID given. Skipping...") | |||||
else: | |||||
config["Tokens"]["Imgur"] = token | |||||
print("Finished preferences.ini setup.") | |||||
print("There are more options avaliable in the file (found at ./roxbot/settings/preferences.ini) if you want to make optional tweaks to Roxbot.") | |||||
print("Exiting...") |