mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-06 03:08:55 -05:00
Custom prefix, can now change settings on the fly
!setting [setting] [value]
This commit is contained in:
parent
ef05727477
commit
970c3a5ef0
@ -5,7 +5,7 @@ import glob
|
|||||||
|
|
||||||
default_settings = ('{"TRIVIA_ADMIN_ONLY": false, "EDIT_CC_ADMIN_ONLY": false, "PASSWORD": "PASSWORDHERE", "FILTER": true, "CUSTOMCOMMANDS": true, ' +
|
default_settings = ('{"TRIVIA_ADMIN_ONLY": false, "EDIT_CC_ADMIN_ONLY": false, "PASSWORD": "PASSWORDHERE", "FILTER": true, "CUSTOMCOMMANDS": true, ' +
|
||||||
'"TRIVIA_MAX_SCORE": 10, "TRIVIA_DELAY": 15, "LOGGING": true, "EMAIL": "EMAILHERE", "ADMINROLE": "Transistor", "DOWNLOADMODE" : true, ' +
|
'"TRIVIA_MAX_SCORE": 10, "TRIVIA_DELAY": 15, "LOGGING": true, "EMAIL": "EMAILHERE", "ADMINROLE": "Transistor", "DOWNLOADMODE" : true, ' +
|
||||||
'"VOLUME": 0.20, "TRIVIA_BOT_PLAYS" : false, "TRIVIA_TIMEOUT" : 120, "DEBUG_ID" : "IgnoreThis", "POLL_DURATION" : 60}')
|
'"VOLUME": 0.20, "TRIVIA_BOT_PLAYS" : false, "TRIVIA_TIMEOUT" : 120, "DEBUG_ID" : "IgnoreThis", "POLL_DURATION" : 60, "PREFIX" : "!"}')
|
||||||
|
|
||||||
default_apis = ('{"IMGFLIP_USERNAME": "USERNAMEHERE", "IMGFLIP_PASSWORD": "PASSWORDHERE", "MYAPIFILMS_TOKEN" : "TOKENHERE"}')
|
default_apis = ('{"IMGFLIP_USERNAME": "USERNAMEHERE", "IMGFLIP_PASSWORD": "PASSWORDHERE", "MYAPIFILMS_TOKEN" : "TOKENHERE"}')
|
||||||
|
|
||||||
@ -99,12 +99,19 @@ def createEmptyFiles():
|
|||||||
admin_role = input(">")
|
admin_role = input(">")
|
||||||
if admin_role == "":
|
if admin_role == "":
|
||||||
admin_role = "Transistor"
|
admin_role = "Transistor"
|
||||||
|
print("Command prefix? Leave empty for default, '!'. Maximum 1 character.")
|
||||||
|
prefix = input(">")
|
||||||
|
if len(prefix) != 1 or prefix == " ":
|
||||||
|
print("Invalid prefix. Setting prefix as '!'...")
|
||||||
|
prefix = "!"
|
||||||
new_settings = json.loads(default_settings)
|
new_settings = json.loads(default_settings)
|
||||||
new_settings["EMAIL"] = email
|
new_settings["EMAIL"] = email
|
||||||
new_settings["PASSWORD"] = password
|
new_settings["PASSWORD"] = password
|
||||||
new_settings["ADMINROLE"] = admin_role
|
new_settings["ADMINROLE"] = admin_role
|
||||||
|
new_settings["PREFIX"] = prefix
|
||||||
fileIO("json/settings.json", "save", new_settings )
|
fileIO("json/settings.json", "save", new_settings )
|
||||||
logger.info("Settings have been saved.")
|
logger.info("Settings have been saved.")
|
||||||
|
|
||||||
if not os.path.isfile("json/apis.json"):
|
if not os.path.isfile("json/apis.json"):
|
||||||
logger.info("Missing apis.json. Creating it...\n")
|
logger.info("Missing apis.json. Creating it...\n")
|
||||||
fileIO("json/apis.json", "save", json.loads(default_apis))
|
fileIO("json/apis.json", "save", json.loads(default_apis))
|
||||||
|
|||||||
52
economy.py
52
economy.py
@ -4,6 +4,7 @@ import time
|
|||||||
import dataIO
|
import dataIO
|
||||||
|
|
||||||
client = None
|
client = None
|
||||||
|
settings = []
|
||||||
#words = dataIO.loadWords()
|
#words = dataIO.loadWords()
|
||||||
#anagram_sessions_timestamps = {}
|
#anagram_sessions_timestamps = {}
|
||||||
anagram_sessions = []
|
anagram_sessions = []
|
||||||
@ -11,6 +12,13 @@ payday_register = {}
|
|||||||
PAYDAY_TIME = 300 # seconds between each payday
|
PAYDAY_TIME = 300 # seconds between each payday
|
||||||
PAYDAY_CREDITS = 120 # credits received
|
PAYDAY_CREDITS = 120 # credits received
|
||||||
|
|
||||||
|
bank = dataIO.fileIO("json/economy.json", "load")
|
||||||
|
|
||||||
|
def loadHelp():
|
||||||
|
global slot_help, economy_exp
|
||||||
|
|
||||||
|
if settings == []: return False #first run
|
||||||
|
|
||||||
slot_help = """ Slot machine payouts:
|
slot_help = """ Slot machine payouts:
|
||||||
:two: :two: :six: Bet * 5000
|
:two: :two: :six: Bet * 5000
|
||||||
:four_leaf_clover: :four_leaf_clover: :four_leaf_clover: +1000
|
:four_leaf_clover: :four_leaf_clover: :four_leaf_clover: +1000
|
||||||
@ -21,47 +29,42 @@ slot_help = """ Slot machine payouts:
|
|||||||
Three symbols: +500
|
Three symbols: +500
|
||||||
Two symbols: Bet * 2
|
Two symbols: Bet * 2
|
||||||
|
|
||||||
You need an account to play. !register one.
|
You need an account to play. {0}register one.
|
||||||
Bet range: 5 - 100
|
Bet range: 5 - 100
|
||||||
"""
|
""".format(settings["PREFIX"])
|
||||||
|
|
||||||
economy_exp = """ **Economy. Get rich and have fun with imaginary currency!**
|
economy_exp = """ **Economy. Get rich and have fun with imaginary currency!**
|
||||||
|
|
||||||
!register - Register an account at the Twentysix bank
|
{0}register - Register an account at the Twentysix bank
|
||||||
!balance - Check your balance
|
{0}balance - Check your balance
|
||||||
!slot help - Slot machine explanation
|
{0}slot help - Slot machine explanation
|
||||||
!slot [bid] - Play the slot machine
|
{0}slot [bid] - Play the slot machine
|
||||||
!payday - Type it every {} seconds to receive some credits.
|
{0}payday - Type it every {1} seconds to receive some credits.
|
||||||
""".format(str(PAYDAY_TIME))
|
""".format(settings["PREFIX"], str(PAYDAY_TIME))
|
||||||
#!payday - Get some cash every 10 minutes
|
|
||||||
|
|
||||||
def initialize(c):
|
|
||||||
global client, bank
|
|
||||||
bank = dataIO.fileIO("json/economy.json", "load")
|
|
||||||
client = c
|
|
||||||
|
|
||||||
async def checkCommands(message):
|
async def checkCommands(message):
|
||||||
|
p = settings["PREFIX"]
|
||||||
cmd = message.content
|
cmd = message.content
|
||||||
user = message.author
|
user = message.author
|
||||||
if cmd == "!balance":
|
if cmd == p + "balance":
|
||||||
if accountCheck(user.id):
|
if accountCheck(user.id):
|
||||||
await client.send_message(message.channel, "{} `Your balance is: {}`".format(user.mention, str(checkBalance(user.id))))
|
await client.send_message(message.channel, "{} `Your balance is: {}`".format(user.mention, str(checkBalance(user.id))))
|
||||||
else:
|
else:
|
||||||
await client.send_message(message.channel, "{} `You don't have an account at the Twentysix bank. Type !register to open one.`".format(user.mention, str(checkBalance(user.id))))
|
await client.send_message(message.channel, "{} `You don't have an account at the Twentysix bank. Type !register to open one.`".format(user.mention, str(checkBalance(user.id))))
|
||||||
elif cmd == "!register":
|
elif cmd == p + "register":
|
||||||
await registerAccount(user, message)
|
await registerAccount(user, message)
|
||||||
elif cmd == "!slot help":
|
elif cmd == p + "slot help":
|
||||||
await client.send_message(message.author, slot_help)
|
await client.send_message(message.author, slot_help)
|
||||||
await client.send_message(message.channel, "{} `Check your DMs for the slot machine explanation.`".format(message.author.mention))
|
await client.send_message(message.channel, "{} `Check your DMs for the slot machine explanation.`".format(message.author.mention))
|
||||||
elif cmd.startswith("!slot"):
|
elif cmd.startswith(p + "slot"):
|
||||||
await slotMachineCheck(message)
|
await slotMachineCheck(message)
|
||||||
elif cmd == "!economy":
|
elif cmd == p + "economy":
|
||||||
await client.send_message(message.author, economy_exp)
|
await client.send_message(message.author, economy_exp)
|
||||||
await client.send_message(message.channel, "{} `Check your DMs for the economy explanation.`".format(message.author.mention))
|
await client.send_message(message.channel, "{} `Check your DMs for the economy explanation.`".format(message.author.mention))
|
||||||
elif cmd == "!challenge":
|
elif cmd == p + "challenge":
|
||||||
#isChallengeOngoing(message)
|
#isChallengeOngoing(message)
|
||||||
pass
|
pass
|
||||||
elif cmd == "!payday":
|
elif cmd == p + "payday":
|
||||||
await payday(message)
|
await payday(message)
|
||||||
|
|
||||||
async def registerAccount(user, message):
|
async def registerAccount(user, message):
|
||||||
@ -147,6 +150,7 @@ async def payday(message):
|
|||||||
###############SLOT##############
|
###############SLOT##############
|
||||||
|
|
||||||
async def slotMachineCheck(message):
|
async def slotMachineCheck(message):
|
||||||
|
p = settings["PREFIX"]
|
||||||
msg = message.content.split()
|
msg = message.content.split()
|
||||||
if len(msg) == 2:
|
if len(msg) == 2:
|
||||||
if msg[1].isdigit():
|
if msg[1].isdigit():
|
||||||
@ -157,11 +161,11 @@ async def slotMachineCheck(message):
|
|||||||
else:
|
else:
|
||||||
await client.send_message(message.channel, "{} `Bid must be between 5 and 100.`".format(message.author.mention))
|
await client.send_message(message.channel, "{} `Bid must be between 5 and 100.`".format(message.author.mention))
|
||||||
else:
|
else:
|
||||||
await client.send_message(message.channel, "{} `You need an account with enough funds to play the slot machine. (!economy)`".format(message.author.mention))
|
await client.send_message(message.channel, "{0} `You need an account with enough funds to play the slot machine. ({1}economy)`".format(message.author.mention, settings["PREFIX"]))
|
||||||
else:
|
else:
|
||||||
await client.send_message(message.channel, "{} `!slot [bid]`".format(message.author.mention))
|
await client.send_message(message.channel, "{} `".format(message.author.mention) + p + "slot [bid]`")
|
||||||
else:
|
else:
|
||||||
await client.send_message(message.channel, "{} `!slot [bid]`".format(message.author.mention))
|
await client.send_message(message.channel, "{} `".format(message.author.mention) + p + "slot [bid]`")
|
||||||
|
|
||||||
async def slotMachine(message, bid):
|
async def slotMachine(message, bid):
|
||||||
reel_pattern = [":cherries:", ":cookie:", ":two:", ":four_leaf_clover:", ":cyclone:", ":sunflower:", ":six:", ":mushroom:", ":heart:", ":snowflake:"]
|
reel_pattern = [":cherries:", ":cookie:", ":two:", ":four_leaf_clover:", ":cyclone:", ":sunflower:", ":six:", ":mushroom:", ":heart:", ":snowflake:"]
|
||||||
|
|||||||
457
red.py
457
red.py
@ -28,89 +28,83 @@ import youtubeparser
|
|||||||
|
|
||||||
from sys import modules
|
from sys import modules
|
||||||
|
|
||||||
|
#settings = {"PREFIX" : "!"} #prevents boot error
|
||||||
|
|
||||||
|
def loadHelp():
|
||||||
|
global help, audio_help, meme_help, admin_help, trivia_help
|
||||||
|
|
||||||
help = """**Commands list:**
|
help = """**Commands list:**
|
||||||
!flip - Flip a coin
|
{0}flip - Flip a coin
|
||||||
!rps [rock or paper o scissors] - Play rock paper scissors
|
{0}rps [rock or paper o scissors] - Play rock paper scissors
|
||||||
!proverb
|
{0}proverb
|
||||||
!choose option1 or option2 or option3 (...) - Random choice
|
{0}choose option1 or option2 or option3 (...) - Random choice
|
||||||
!8 [question] - Ask 8 ball
|
{0}8 [question] - Ask 8 ball
|
||||||
!sw - Start/stop the stopwatch
|
{0}sw - Start/stop the stopwatch
|
||||||
!avatar [name or mention] - Shows user's avatar
|
{0}avatar [name or mention] - Shows user's avatar
|
||||||
!trivia start - Start a trivia session
|
{0}trivia start - Start a trivia session
|
||||||
!trivia stop - Stop a trivia session
|
{0}trivia stop - Stop a trivia session
|
||||||
!twitch [stream] - Check if stream is online
|
{0}twitch [stream] - Check if stream is online
|
||||||
!twitchalert [stream] - Whenever the stream is online the bot will send an alert in the channel (admin only)
|
{0}twitchalert [stream] - Whenever the stream is online the bot will send an alert in the channel (admin only)
|
||||||
!stoptwitchalert [stream] - Stop sending alerts about the specified stream in the channel (admin only)
|
{0}stoptwitchalert [stream] - Stop sending alerts about the specified stream in the channel (admin only)
|
||||||
!roll [number] - Random number between 0 and [number]
|
{0}roll [number] - Random number between 0 and [number]
|
||||||
!gif [text] - GIF search
|
{0}gif [text] - GIF search
|
||||||
!imdb - Retrieves a movie's information from IMDB using its title
|
{0}imdb - Retrieves a movie's information from IMDB using its title
|
||||||
!urban [text] - Search definitions in the urban dictionary
|
{0}urban [text] - Search definitions in the urban dictionary
|
||||||
!meme [ID;Text1;Text2] - Create a meme
|
{0}meme [ID;Text1;Text2] - Create a meme
|
||||||
!imdb [search terms] - Search on IMDB
|
{0}imdb [search terms] - Search on IMDB
|
||||||
!customcommands - Custom commands' list
|
{0}customcommands - Custom commands' list
|
||||||
!addcom [command] [text] - Add a custom command
|
{0}addcom [command] [text] - Add a custom command
|
||||||
!editcom [command] [text] - Edit a custom command
|
{0}editcom [command] [text] - Edit a custom command
|
||||||
!delcom [command] - Delete a custom command
|
{0}delcom [command] - Delete a custom command
|
||||||
|
|
||||||
!meme help - Memes help
|
{0}meme help - Memes help
|
||||||
!audio help - Audio related commands
|
{0}audio help - Audio related commands
|
||||||
!economy - Economy explanation, if available
|
{0}economy - Economy explanation, if available
|
||||||
!trivia - Trivia commands and lists
|
{0}trivia - Trivia commands and lists
|
||||||
"""
|
""".format(settings["PREFIX"])
|
||||||
|
|
||||||
youtube_dl_options = {
|
|
||||||
'format': 'bestaudio/best',
|
|
||||||
'extractaudio': True,
|
|
||||||
'audioformat': "mp3",
|
|
||||||
'outtmpl': '%(id)s',
|
|
||||||
'noplaylist': True,
|
|
||||||
'nocheckcertificate': True,
|
|
||||||
'ignoreerrors': True,
|
|
||||||
'quiet': True,
|
|
||||||
'no_warnings': True,
|
|
||||||
'outtmpl': "cache/%(id)s"}
|
|
||||||
|
|
||||||
audio_help = """
|
audio_help = """
|
||||||
**General audio help commands:**
|
**General audio help commands:**
|
||||||
!next or !skip - Next song
|
{0}next or {0}skip - Next song
|
||||||
!prev - Previous song
|
{0}prev - Previous song
|
||||||
!pause - Pause song
|
{0}pause - Pause song
|
||||||
!resume - Resume song
|
{0}resume - Resume song
|
||||||
!repeat or !replay - Replay current song
|
{0}repeat or {0}replay - Replay current song
|
||||||
!title or !song - Current song's title + link
|
{0}title or {0}song - Current song's title + link
|
||||||
!youtube [link] - Play a youtube video in a voice channel
|
{0}youtube [link] - Play a youtube video in a voice channel
|
||||||
!sing - Make Red sing
|
{0}sing - Make Red sing
|
||||||
!stop - Stop any voice channel activity
|
{0}stop - Stop any voice channel activity
|
||||||
!volume [0-1] - Sets the volume
|
{0}volume [0-1] - Sets the volume
|
||||||
!downloadmode - Disables/enables download mode (admin only)
|
{0}downloadmode - Disables/enables download mode (admin only)
|
||||||
|
|
||||||
**Playlist commands:**
|
**Playlist commands:**
|
||||||
!play [playlist_name] - Play chosen playlist
|
{0}play [playlist_name] - Play chosen playlist
|
||||||
!playlists - Playlists' list
|
{0}playlists - Playlists' list
|
||||||
!shuffle - Mix music list
|
{0}shuffle - Mix music list
|
||||||
!addplaylist [name] [link] - Add a youtube playlist. Link format example: https://www.youtube.com/playlist?list=PLe8jmEHFkvsaDOOWcREvkgFoj6MD0pXXX
|
{0}addplaylist [name] [link] - Add a youtube playlist. Link format example: https://www.youtube.com/playlist?list=PLe8jmEHFkvsaDOOWcREvkgFoj6MD0pXXX
|
||||||
!delplaylist [name] - Delete a youtube playlist. Limited to author and admins.
|
{0}delplaylist [name] - Delete a youtube playlist. Limited to author and admins.
|
||||||
!getplaylist - Receive the current playlist through DM. This also works with favorites.
|
{0}getplaylist - Receive the current playlist through DM. This also works with favorites.
|
||||||
|
|
||||||
**Local commands:**
|
**Local commands:**
|
||||||
!local [playlist_name] - Play chosen local playlist
|
{0}local [playlist_name] - Play chosen local playlist
|
||||||
!locallist or !local or !locals - Local playlists' list
|
{0}locallist or {0}local or {0}locals - Local playlists' list
|
||||||
|
|
||||||
**Favorites:**
|
**Favorites:**
|
||||||
!addfavorite - Add song to your favorites
|
{0}addfavorite - Add song to your favorites
|
||||||
!delfavorite - Remove song from your favorites
|
{0}delfavorite - Remove song from your favorites
|
||||||
!playfavorites - Play your favorites
|
{0}playfavorites - Play your favorites
|
||||||
|
|
||||||
**You can submit your own playlist by doing the following:**
|
**You can submit your own playlist by doing the following:**
|
||||||
1) Make a txt file. Name must be only letters, numbers and underscores. It will be your playlist's name, so choose wisely.
|
1) Make a txt file. Name must be only letters, numbers and underscores. It will be your playlist's name, so choose wisely.
|
||||||
2) One youtube link each line.
|
2) One youtube link each line.
|
||||||
3) Send me the txt. If any line is incorrect I will reject it.
|
3) Send me the txt. If any line is incorrect I will reject it.
|
||||||
4) Listen to it with !play [playlist_name]!
|
4) Listen to it with {0}play [playlist_name]!
|
||||||
"""
|
""".format(settings["PREFIX"])
|
||||||
|
|
||||||
meme_help = """
|
meme_help = """
|
||||||
Usage example:
|
Usage example:
|
||||||
One-Does-Not-Simply Template ID: 61579
|
One-Does-Not-Simply Template ID: 61579
|
||||||
!meme 61579;Test;Test
|
{0}meme 61579;Test;Test
|
||||||
|
|
||||||
Memes list:
|
Memes list:
|
||||||
ID Name
|
ID Name
|
||||||
@ -161,34 +155,47 @@ ID Name
|
|||||||
|
|
||||||
For more memes: `https://imgflip.com/memetemplates`
|
For more memes: `https://imgflip.com/memetemplates`
|
||||||
Choose a meme, click on "Blank Template" then add the ID
|
Choose a meme, click on "Blank Template" then add the ID
|
||||||
"""
|
""".format(settings["PREFIX"])
|
||||||
|
|
||||||
admin_help = """
|
admin_help = """
|
||||||
**Admin commands:**
|
**Admin commands:**
|
||||||
!addwords [word1 word2 (...)] [phrase/with/many/words] - Add words to message filter
|
{0}addwords [word1 word2 (...)] [phrase/with/many/words] - Add words to message filter
|
||||||
!removewords [word1 word2 (...)] [phrase/with/many/words] - Remove words from message filter
|
{0}removewords [word1 word2 (...)] [phrase/with/many/words] - Remove words from message filter
|
||||||
!addregex [regex] - Add regular expression to message filter
|
{0}addregex [regex] - Add regular expression to message filter
|
||||||
!removeregex [regex] - Remove regular expression from message filter
|
{0}removeregex [regex] - Remove regular expression from message filter
|
||||||
!shutdown - Shutdown the bot
|
{0}shutdown - Shutdown the bot
|
||||||
!join [invite] - Join another server
|
{0}join [invite] - Join another server
|
||||||
!leaveserver - Leave server
|
{0}leaveserver - Leave server
|
||||||
!shush - Ignore the current channel
|
{0}shush - Ignore the current channel
|
||||||
!talk - Stop ignoring the current channel
|
{0}talk - Stop ignoring the current channel
|
||||||
!reload - Reload most files. Useful in case of manual edits
|
{0}reload - Reload most files. Useful in case of manual edits
|
||||||
!name [name] - Change the bot's name
|
{0}name [name] - Change the bot's name
|
||||||
!cleanup [number] - Delete the last [number] messages
|
{0}cleanup [number] - Delete the last [number] messages
|
||||||
!cleanup [name/mention] [number] - Delete the last [number] of messages by [name]
|
{0}cleanup [name/mention] [number] - Delete the last [number] of messages by [name]
|
||||||
!blacklist [name/mention] - Add user to Red's blacklist
|
{0}blacklist [name/mention] - Add user to Red's blacklist
|
||||||
!forgive [name/mention] - Removes user from Red's blacklist
|
{0}forgive [name/mention] - Removes user from Red's blacklist
|
||||||
"""
|
{0}setting [setting] [value] - Modify setting
|
||||||
|
""".format(settings["PREFIX"])
|
||||||
|
|
||||||
trivia_help = """
|
trivia_help = """
|
||||||
**Trivia commands:**
|
**Trivia commands:**
|
||||||
!trivia - Trivia questions lists and help
|
{0}trivia - Trivia questions lists and help
|
||||||
!trivia [name] - Starts trivia session with specified list
|
{0}trivia [name] - Starts trivia session with specified list
|
||||||
!trivia random - Starts trivia session with random list
|
{0}trivia random - Starts trivia session with random list
|
||||||
!trivia stop - Stop trivia session
|
{0}trivia stop - Stop trivia session
|
||||||
"""
|
""".format(settings["PREFIX"])
|
||||||
|
|
||||||
|
youtube_dl_options = {
|
||||||
|
'format': 'bestaudio/best',
|
||||||
|
'extractaudio': True,
|
||||||
|
'audioformat': "mp3",
|
||||||
|
'outtmpl': '%(id)s',
|
||||||
|
'noplaylist': True,
|
||||||
|
'nocheckcertificate': True,
|
||||||
|
'ignoreerrors': True,
|
||||||
|
'quiet': True,
|
||||||
|
'no_warnings': True,
|
||||||
|
'outtmpl': "cache/%(id)s"}
|
||||||
|
|
||||||
client = discord.Client()
|
client = discord.Client()
|
||||||
|
|
||||||
@ -199,6 +206,8 @@ if not discord.opus.is_loaded():
|
|||||||
async def on_message(message):
|
async def on_message(message):
|
||||||
global trivia_sessions
|
global trivia_sessions
|
||||||
|
|
||||||
|
p = settings["PREFIX"]
|
||||||
|
|
||||||
await gameSwitcher.changeGame()
|
await gameSwitcher.changeGame()
|
||||||
|
|
||||||
if message.author.id in blacklisted_users and not isMemberAdmin(message):
|
if message.author.id in blacklisted_users and not isMemberAdmin(message):
|
||||||
@ -211,7 +220,7 @@ async def on_message(message):
|
|||||||
if settings["FILTER"] and not isMemberAdmin(message):
|
if settings["FILTER"] and not isMemberAdmin(message):
|
||||||
if await checkFilter(message) or await checkRegex(message):
|
if await checkFilter(message) or await checkRegex(message):
|
||||||
return False #exits without checking for commands
|
return False #exits without checking for commands
|
||||||
if message.channel.id in shush_list and message.content == "!talk":
|
if message.channel.id in shush_list and message.content == p + "talk":
|
||||||
await talk(message)
|
await talk(message)
|
||||||
|
|
||||||
if message.channel.id not in shush_list:
|
if message.channel.id not in shush_list:
|
||||||
@ -221,117 +230,117 @@ async def on_message(message):
|
|||||||
await client.send_message(message.channel, "`" + choice(greetings) + "`")
|
await client.send_message(message.channel, "`" + choice(greetings) + "`")
|
||||||
elif message.content == client.user.mention + " ?" or message.content == client.user.mention + "?":
|
elif message.content == client.user.mention + " ?" or message.content == client.user.mention + "?":
|
||||||
await client.send_message(message.channel, "`" + choice(greetings) + "`")
|
await client.send_message(message.channel, "`" + choice(greetings) + "`")
|
||||||
elif message.content == "!flip":
|
elif message.content == p + "flip":
|
||||||
await client.send_message(message.channel, "*flips a coin and... " + choice(["HEADS!*", "TAILS!*"]))
|
await client.send_message(message.channel, "*flips a coin and... " + choice(["HEADS!*", "TAILS!*"]))
|
||||||
elif message.content.startswith("!rps"):
|
elif message.content.startswith(p + "rps"):
|
||||||
await rpsgame(message)
|
await rpsgame(message)
|
||||||
elif message.content == "!proverb":
|
elif message.content == p + "proverb":
|
||||||
await client.send_message(message.channel, "`" + choice(proverbs) + "`")
|
await client.send_message(message.channel, "`" + choice(proverbs) + "`")
|
||||||
elif message.content == "!help":
|
elif message.content == p + "help":
|
||||||
await client.send_message(message.author, help)
|
await client.send_message(message.author, help)
|
||||||
await client.send_message(message.channel, "{} `Check your DMs for the command list.`".format(message.author.mention))
|
await client.send_message(message.channel, "{} `Check your DMs for the command list.`".format(message.author.mention))
|
||||||
elif message.content.startswith('!choose'):
|
elif message.content.startswith(p + 'choose'):
|
||||||
await randomchoice(message)
|
await randomchoice(message)
|
||||||
elif message.content.startswith('!8 ') and message.content.endswith("?") and len(message.content) > 5:
|
elif message.content.startswith(p + '8 ') and message.content.endswith("?") and len(message.content) > 5:
|
||||||
await client.send_message(message.channel, "{}: ".format(message.author.mention) + "`" + choice(ball) + "`")
|
await client.send_message(message.channel, "{}: ".format(message.author.mention) + "`" + choice(ball) + "`")
|
||||||
elif message.content.startswith('!roll'):
|
elif message.content.startswith(p + 'roll'):
|
||||||
await roll(message)
|
await roll(message)
|
||||||
elif message.content.startswith('!addcom'):
|
elif message.content.startswith(p + 'addcom'):
|
||||||
await addcom(message)
|
await addcom(message)
|
||||||
elif message.content.startswith('!editcom'):
|
elif message.content.startswith(p + 'editcom'):
|
||||||
await editcom(message)
|
await editcom(message)
|
||||||
elif message.content.startswith('!delcom'):
|
elif message.content.startswith(p + 'delcom'):
|
||||||
await delcom(message)
|
await delcom(message)
|
||||||
elif message.content == "!customcommands":
|
elif message.content == p + "customcommands":
|
||||||
await listCustomCommands(message)
|
await listCustomCommands(message)
|
||||||
elif message.content.startswith('!sw'):
|
elif message.content.startswith(p + 'sw'):
|
||||||
await stopwatch(message)
|
await stopwatch(message)
|
||||||
elif message.content.startswith('!id'):
|
elif message.content.startswith(p + 'id'):
|
||||||
await client.send_message(message.channel, "{} `Your id is {}`".format(message.author.mention, message.author.id))
|
await client.send_message(message.channel, "{} `Your id is {}`".format(message.author.mention, message.author.id))
|
||||||
elif message.content.startswith('!twitchalert'):
|
elif message.content.startswith(p + 'twitchalert'):
|
||||||
await addTwitchAlert(message)
|
await addTwitchAlert(message)
|
||||||
elif message.content.startswith('!stoptwitchalert'):
|
elif message.content.startswith(p + 'stoptwitchalert'):
|
||||||
await removeTwitchAlert(message)
|
await removeTwitchAlert(message)
|
||||||
elif message.content.startswith('!twitch'):
|
elif message.content.startswith(p + 'twitch'):
|
||||||
await twitchCheck(message)
|
await twitchCheck(message)
|
||||||
elif message.content.startswith('!image'):
|
elif message.content.startswith(p + 'image'):
|
||||||
#image(message)
|
#image(message)
|
||||||
pass
|
pass
|
||||||
elif message.content.startswith('!gif'):
|
elif message.content.startswith(p + 'gif'):
|
||||||
await gif(message)
|
await gif(message)
|
||||||
elif message.content.startswith('!imdb'):
|
elif message.content.startswith(p + 'imdb'):
|
||||||
await imdb(message)
|
await imdb(message)
|
||||||
elif message.content.startswith('!urban'):
|
elif message.content.startswith(p + 'urban'):
|
||||||
await urban(message)
|
await urban(message)
|
||||||
elif message.content.startswith('!uptime'):
|
elif message.content.startswith(p + 'uptime'):
|
||||||
await uptime(message)
|
await uptime(message)
|
||||||
elif message.content.startswith('!avatar'):
|
elif message.content.startswith(p + 'avatar'):
|
||||||
await avatar(message)
|
await avatar(message)
|
||||||
elif message.content == '!meme help' or message.content == '!memes':
|
elif message.content == p + 'meme help' or message.content == p + 'memes':
|
||||||
await client.send_message(message.author, meme_help)
|
await client.send_message(message.author, meme_help)
|
||||||
await client.send_message(message.channel, "{} `Check your DMs for !meme help.`".format(message.author.mention))
|
await client.send_message(message.channel, "{} `Check your DMs for " + p +"meme help.`".format(message.author.mention))
|
||||||
elif message.content.startswith ('!meme'):
|
elif message.content.startswith (p + 'meme'):
|
||||||
await memes(message)
|
await memes(message)
|
||||||
################## music #######################
|
################## music #######################
|
||||||
elif message.content == "!sing":
|
elif message.content == p + "sing":
|
||||||
await playPlaylist(message, sing=True)
|
await playPlaylist(message, sing=True)
|
||||||
elif message.content.startswith('!youtube'):
|
elif message.content.startswith(p + 'youtube'):
|
||||||
await playVideo(message)
|
await playVideo(message)
|
||||||
elif message.content.startswith('!play '):
|
elif message.content.startswith(p + 'play '):
|
||||||
await playPlaylist(message)
|
await playPlaylist(message)
|
||||||
elif message.content.startswith('!local '):
|
elif message.content.startswith(p + 'local '):
|
||||||
await playLocal(message)
|
await playLocal(message)
|
||||||
elif message.content == "!local" or message.content == "!locallist" or message.content == "!locals":
|
elif message.content == p + "local" or message.content == p + "locallist" or message.content == p + "locals":
|
||||||
await listLocal(message)
|
await listLocal(message)
|
||||||
await client.send_message(message.channel, "{} `Check your DMs for the local playlists list.`".format(message.author.mention))
|
await client.send_message(message.channel, "{} `Check your DMs for the local playlists list.`".format(message.author.mention))
|
||||||
elif message.content == "!stop":
|
elif message.content == p + "stop":
|
||||||
await leaveVoice()
|
await leaveVoice()
|
||||||
elif message.content == "!playlist" or message.content == "!playlists":
|
elif message.content == p + "playlist" or message.content == p + "playlists":
|
||||||
await listPlaylists(message)
|
await listPlaylists(message)
|
||||||
await client.send_message(message.channel, "{} `Check your DMs for the playlists list.`".format(message.author.mention))
|
await client.send_message(message.channel, "{} `Check your DMs for the playlists list.`".format(message.author.mention))
|
||||||
elif message.content == "!skip" or message.content == "!next":
|
elif message.content == p + "skip" or message.content == p + "next":
|
||||||
if currentPlaylist: currentPlaylist.nextSong(currentPlaylist.getNextSong())
|
if currentPlaylist: currentPlaylist.nextSong(currentPlaylist.getNextSong())
|
||||||
elif message.content == "!prev" or message.content == "!previous":
|
elif message.content == p + "prev" or message.content == p + "previous":
|
||||||
if currentPlaylist: currentPlaylist.nextSong(currentPlaylist.getPreviousSong())
|
if currentPlaylist: currentPlaylist.nextSong(currentPlaylist.getPreviousSong())
|
||||||
elif message.content == "!repeat" or message.content == "!replay":
|
elif message.content == p + "repeat" or message.content == p + "replay":
|
||||||
if currentPlaylist: currentPlaylist.nextSong(currentPlaylist.current)
|
if currentPlaylist: currentPlaylist.nextSong(currentPlaylist.current)
|
||||||
elif message.content == "!pause":
|
elif message.content == p + "pause":
|
||||||
if currentPlaylist: currentPlaylist.pause()
|
if currentPlaylist: currentPlaylist.pause()
|
||||||
elif message.content == "!resume":
|
elif message.content == p + "resume":
|
||||||
if currentPlaylist: currentPlaylist.resume()
|
if currentPlaylist: currentPlaylist.resume()
|
||||||
elif message.content == "!shuffle":
|
elif message.content == p + "shuffle":
|
||||||
if currentPlaylist: currentPlaylist.shuffle()
|
if currentPlaylist: currentPlaylist.shuffle()
|
||||||
elif message.content == "!song" or message.content == "!title" :
|
elif message.content == p + "song" or message.content == p + "title" :
|
||||||
if currentPlaylist: await getSongTitle(message)
|
if currentPlaylist: await getSongTitle(message)
|
||||||
elif message.content == "!audio help":
|
elif message.content == p + "audio help":
|
||||||
await client.send_message(message.author, audio_help)
|
await client.send_message(message.author, audio_help)
|
||||||
await client.send_message(message.channel, "{} `Check your DMs for the audio help.`".format(message.author.mention))
|
await client.send_message(message.channel, "{} `Check your DMs for the audio help.`".format(message.author.mention))
|
||||||
elif message.content.startswith("!addplaylist"):
|
elif message.content.startswith(p + "addplaylist"):
|
||||||
await addPlaylist(message)
|
await addPlaylist(message)
|
||||||
elif message.content.startswith("!delplaylist"):
|
elif message.content.startswith(p + "delplaylist"):
|
||||||
await delPlaylist(message)
|
await delPlaylist(message)
|
||||||
elif message.content == "!addfavorite":
|
elif message.content == p + "addfavorite":
|
||||||
await addToFavorites(message)
|
await addToFavorites(message)
|
||||||
elif message.content == "!delfavorite":
|
elif message.content == p + "delfavorite":
|
||||||
await removeFromFavorites(message)
|
await removeFromFavorites(message)
|
||||||
elif message.content == "!playfavorites":
|
elif message.content == p + "playfavorites":
|
||||||
await playFavorites(message)
|
await playFavorites(message)
|
||||||
elif message.content == "!getplaylist":
|
elif message.content == p + "getplaylist":
|
||||||
await sendPlaylist(message)
|
await sendPlaylist(message)
|
||||||
elif message.content.startswith("!volume"):
|
elif message.content.startswith(p + "volume"):
|
||||||
await setVolume(message)
|
await setVolume(message)
|
||||||
elif message.content == "!downloadmode":
|
elif message.content == p + "downloadmode":
|
||||||
await downloadMode(message)
|
await downloadMode(message)
|
||||||
elif message.content == "!endpoll":
|
elif message.content == p + "endpoll":
|
||||||
await endPoll(message)
|
await endPoll(message)
|
||||||
elif message.content.startswith("!poll"):
|
elif message.content.startswith(p + "poll"):
|
||||||
await startPoll(message)
|
await startPoll(message)
|
||||||
################################################
|
################################################
|
||||||
elif message.content == "!trivia":
|
elif message.content == p + "trivia":
|
||||||
await triviaList(message)
|
await triviaList(message)
|
||||||
elif message.content.startswith("!trivia"):
|
elif message.content.startswith(p + "trivia"):
|
||||||
if checkAuth("Trivia", message, settings):
|
if checkAuth("Trivia", message, settings):
|
||||||
if message.content == "!trivia stop":
|
if message.content == p + "trivia stop":
|
||||||
if getTriviabyChannel(message.channel):
|
if getTriviabyChannel(message.channel):
|
||||||
await getTriviabyChannel(message.channel).endGame()
|
await getTriviabyChannel(message.channel).endGame()
|
||||||
await client.send_message(message.channel, "`Trivia stopped.`")
|
await client.send_message(message.channel, "`Trivia stopped.`")
|
||||||
@ -346,43 +355,45 @@ async def on_message(message):
|
|||||||
else:
|
else:
|
||||||
await client.send_message(message.channel, "`Trivia is currently admin-only.`")
|
await client.send_message(message.channel, "`Trivia is currently admin-only.`")
|
||||||
######## Admin commands #######################
|
######## Admin commands #######################
|
||||||
elif message.content.startswith('!addwords'):
|
elif message.content.startswith(p + 'addwords'):
|
||||||
await addBadWords(message)
|
await addBadWords(message)
|
||||||
elif message.content.startswith('!removewords'):
|
elif message.content.startswith(p + 'removewords'):
|
||||||
await removeBadWords(message)
|
await removeBadWords(message)
|
||||||
elif message.content.startswith('!addregex ') and len(message.content) > 11:
|
elif message.content.startswith(p + 'addregex ') and len(message.content) > 11:
|
||||||
await addRegex(message)
|
await addRegex(message)
|
||||||
elif message.content.startswith('!removeregex ') and len(message.content) > 14:
|
elif message.content.startswith(p + 'removeregex ') and len(message.content) > 14:
|
||||||
await removeRegex(message)
|
await removeRegex(message)
|
||||||
elif message.content == "!shutdown":
|
elif message.content == p + "shutdown":
|
||||||
await shutdown(message)
|
await shutdown(message)
|
||||||
elif message.content.startswith('!join'):
|
elif message.content.startswith(p + 'join'):
|
||||||
await join(message)
|
await join(message)
|
||||||
elif message.content == "!leaveserver":
|
elif message.content == p + "leaveserver":
|
||||||
await leave(message)
|
await leave(message)
|
||||||
elif message.content == "!shush":
|
elif message.content == p + "shush":
|
||||||
await shush(message)
|
await shush(message)
|
||||||
elif message.content == "!talk": #prevents !talk custom command
|
elif message.content == p + "talk": #prevents !talk custom command
|
||||||
pass
|
pass
|
||||||
elif message.content == "!reload":
|
elif message.content == p + "reload":
|
||||||
await reloadSettings(message)
|
await reloadSettings(message)
|
||||||
elif message.content.startswith("!name"):
|
elif message.content.startswith(p + "name"):
|
||||||
await changeName(message)
|
await changeName(message)
|
||||||
elif message.content.startswith("!cleanup"):
|
elif message.content.startswith(p + "cleanup"):
|
||||||
await cleanup(message)
|
await cleanup(message)
|
||||||
elif message.content == "!admin help":
|
elif message.content == p + "admin help":
|
||||||
if isMemberAdmin(message):
|
if isMemberAdmin(message):
|
||||||
await client.send_message(message.author, admin_help)
|
await client.send_message(message.author, admin_help)
|
||||||
else:
|
else:
|
||||||
await client.send_message(message.channel, "`Admin status required.`")
|
await client.send_message(message.channel, "`Admin status required.`")
|
||||||
elif message.content.startswith("!debug"):
|
elif message.content.startswith(p + "debug"):
|
||||||
await debug(message)
|
await debug(message)
|
||||||
elif message.content.startswith("!exec"):
|
elif message.content.startswith(p + "exec"):
|
||||||
await execFunc(message)
|
await execFunc(message)
|
||||||
elif message.content.startswith("!blacklist"):
|
elif message.content.startswith(p + "blacklist"):
|
||||||
await blacklist(message, "add")
|
await blacklist(message, "add")
|
||||||
elif message.content.startswith("!forgive"):
|
elif message.content.startswith(p + "forgive"):
|
||||||
await blacklist(message, "remove")
|
await blacklist(message, "remove")
|
||||||
|
elif message.content.startswith(p + "setting"):
|
||||||
|
await modifySettings(message)
|
||||||
###################################
|
###################################
|
||||||
elif getTriviabyChannel(message.channel): #check if trivia is ongoing in the channel
|
elif getTriviabyChannel(message.channel): #check if trivia is ongoing in the channel
|
||||||
trvsession = getTriviabyChannel(message.channel)
|
trvsession = getTriviabyChannel(message.channel)
|
||||||
@ -393,7 +404,7 @@ async def on_message(message):
|
|||||||
if getPollByChannel(message):
|
if getPollByChannel(message):
|
||||||
getPollByChannel(message).checkAnswer(message)
|
getPollByChannel(message).checkAnswer(message)
|
||||||
|
|
||||||
if message.content.startswith('!') and len(message.content) > 2 and settings["CUSTOMCOMMANDS"]:
|
if message.content.startswith(p) and len(message.content) > 2 and settings["CUSTOMCOMMANDS"]:
|
||||||
await customCommand(message)
|
await customCommand(message)
|
||||||
|
|
||||||
@client.async_event
|
@client.async_event
|
||||||
@ -466,7 +477,7 @@ class Trivia():
|
|||||||
await client.send_message(self.channel, "`There is no list with that name.`")
|
await client.send_message(self.channel, "`There is no list with that name.`")
|
||||||
await self.stopTrivia()
|
await self.stopTrivia()
|
||||||
else:
|
else:
|
||||||
await client.send_message(self.channel, "`!trivia [list name]`")
|
await client.send_message(self.channel, "`" + settings["PREFIX"] + "trivia [list name]`")
|
||||||
|
|
||||||
async def stopTrivia(self):
|
async def stopTrivia(self):
|
||||||
global trivia_sessions
|
global trivia_sessions
|
||||||
@ -766,7 +777,7 @@ async def startPoll(message):
|
|||||||
poll_sessions.append(p)
|
poll_sessions.append(p)
|
||||||
await p.start()
|
await p.start()
|
||||||
else:
|
else:
|
||||||
await client.send_message(message.channel, "`!poll question;option1;option2 (...)`")
|
await client.send_message(message.channel, "`" + settings["PREFIX"] + "poll question;option1;option2 (...)`")
|
||||||
else:
|
else:
|
||||||
await client.send_message(message.channel, "`A poll is already ongoing in this channel.`")
|
await client.send_message(message.channel, "`A poll is already ongoing in this channel.`")
|
||||||
|
|
||||||
@ -806,10 +817,10 @@ async def addcom(message):
|
|||||||
logger.info("Saved commands database.")
|
logger.info("Saved commands database.")
|
||||||
await client.send_message(message.channel, "`Custom command successfully added.`")
|
await client.send_message(message.channel, "`Custom command successfully added.`")
|
||||||
else:
|
else:
|
||||||
await client.send_message(message.channel, "`This command already exists. Use !editcom [command] [text]`")
|
await client.send_message(message.channel, "`This command already exists. Use " + settings["PREFIX"] + "editcom [command] [text]`")
|
||||||
|
|
||||||
else:
|
else:
|
||||||
await client.send_message(message.channel, "`!addcom [command] [text]`")
|
await client.send_message(message.channel, "`" + settings["PREFIX"] + "addcom [command] [text]`")
|
||||||
else:
|
else:
|
||||||
await client.send_message(message.channel, "`You don't have permissions to edit custom commands.`")
|
await client.send_message(message.channel, "`You don't have permissions to edit custom commands.`")
|
||||||
|
|
||||||
@ -829,12 +840,12 @@ async def editcom(message):
|
|||||||
logger.info("Saved commands database.")
|
logger.info("Saved commands database.")
|
||||||
await client.send_message(message.channel, "`Custom command successfully edited.`")
|
await client.send_message(message.channel, "`Custom command successfully edited.`")
|
||||||
else:
|
else:
|
||||||
await client.send_message(message.channel, "`That command doesn't exist. Use !addcom [command] [text]`")
|
await client.send_message(message.channel, "`That command doesn't exist. Use " + settings["PREFIX"] + "addcom [command] [text]`")
|
||||||
else:
|
else:
|
||||||
await client.send_message(message.channel, "`There are no custom commands in this server. Use !addcom [command] [text]`")
|
await client.send_message(message.channel, "`There are no custom commands in this server. Use " + settings["PREFIX"] + "addcom [command] [text]`")
|
||||||
|
|
||||||
else:
|
else:
|
||||||
await client.send_message(message.channel, "`!editcom [command] [text]`")
|
await client.send_message(message.channel, "`" + settings["PREFIX"] + "editcom [command] [text]`")
|
||||||
else:
|
else:
|
||||||
await client.send_message(message.channel, "`You don't have permissions to edit custom commands.`")
|
await client.send_message(message.channel, "`You don't have permissions to edit custom commands.`")
|
||||||
|
|
||||||
@ -853,10 +864,10 @@ async def delcom(message):
|
|||||||
else:
|
else:
|
||||||
await client.send_message(message.channel, "`That command doesn't exist.`")
|
await client.send_message(message.channel, "`That command doesn't exist.`")
|
||||||
else:
|
else:
|
||||||
await client.send_message(message.channel, "`There are no custom commands in this server. Use !addcom [command] [text]`")
|
await client.send_message(message.channel, "`There are no custom commands in this server. Use " + settings["PREFIX"] + "addcom [command] [text]`")
|
||||||
|
|
||||||
else:
|
else:
|
||||||
await client.send_message(message.channel, "`!delcom [command]`")
|
await client.send_message(message.channel, "`" + settings["PREFIX"] + "delcom [command]`")
|
||||||
else:
|
else:
|
||||||
await client.send_message(message.channel, "`You don't have permissions to edit custom commands.`")
|
await client.send_message(message.channel, "`You don't have permissions to edit custom commands.`")
|
||||||
|
|
||||||
@ -929,16 +940,16 @@ async def rpsgame(message):
|
|||||||
elif userchoice == "scissors" and botchoice == "paper":
|
elif userchoice == "scissors" and botchoice == "paper":
|
||||||
await client.send_message(message.channel, rps[botchoice] + msgs["win"])
|
await client.send_message(message.channel, rps[botchoice] + msgs["win"])
|
||||||
else:
|
else:
|
||||||
await client.send_message(message.channel, "`!rps [rock or paper or scissors]`")
|
await client.send_message(message.channel, "`" + settings["PREFIX"] + "rps [rock or paper or scissors]`")
|
||||||
else:
|
else:
|
||||||
await client.send_message(message.channel, "`!rps [rock or paper or scissors]`")
|
await client.send_message(message.channel, "`" + settings["PREFIX"] + "rps [rock or paper or scissors]`")
|
||||||
|
|
||||||
async def randomchoice(message):
|
async def randomchoice(message):
|
||||||
sentences = ["Mmm... I think I'll choose ", "I choose ", "I prefer ", "This one is best: ", "This: "]
|
sentences = ["Mmm... I think I'll choose ", "I choose ", "I prefer ", "This one is best: ", "This: "]
|
||||||
msg = message.content[8:] # removes !choose
|
msg = message.content[8:] # removes !choose
|
||||||
msg = msg.split(" or ")
|
msg = msg.split(" or ")
|
||||||
if len(msg) == 1:
|
if len(msg) == 1:
|
||||||
await client.send_message(message.channel, "`!choose option1 or option2 or option3 (...)`")
|
await client.send_message(message.channel, "`" + settings["PREFIX"] + "choose option1 or option2 or option3 (...)`")
|
||||||
elif len(msg) >= 2:
|
elif len(msg) >= 2:
|
||||||
await client.send_message(message.channel, "`" + choice(sentences) + choice(msg) + "`")
|
await client.send_message(message.channel, "`" + choice(sentences) + choice(msg) + "`")
|
||||||
else:
|
else:
|
||||||
@ -953,7 +964,7 @@ async def stopwatch(message):
|
|||||||
stopwatches.pop(message.author.id, None)
|
stopwatches.pop(message.author.id, None)
|
||||||
else:
|
else:
|
||||||
stopwatches[message.author.id] = int(time.perf_counter())
|
stopwatches[message.author.id] = int(time.perf_counter())
|
||||||
await client.send_message(message.channel, "`Stopwatch started! Use !sw to stop it.`")
|
await client.send_message(message.channel, "`Stopwatch started! Use " + settings["PREFIX"] + "sw to stop it.`")
|
||||||
|
|
||||||
"""
|
"""
|
||||||
async def image(message): # API's dead.
|
async def image(message): # API's dead.
|
||||||
@ -999,7 +1010,7 @@ async def imdb(message): # Method added by BananaWaffles.
|
|||||||
else:
|
else:
|
||||||
await client.send_message(message.channel, "`Invalid search.`")
|
await client.send_message(message.channel, "`Invalid search.`")
|
||||||
else:
|
else:
|
||||||
await client.send_message(message.channel, "`!imdb [text]`")
|
await client.send_message(message.channel, "`" + settings["PREFIX"] + "imdb [text]`")
|
||||||
|
|
||||||
async def memes(message):
|
async def memes(message):
|
||||||
msg = message.content[6:]
|
msg = message.content[6:]
|
||||||
@ -1020,9 +1031,9 @@ async def memes(message):
|
|||||||
error = result["error_message"]
|
error = result["error_message"]
|
||||||
await client.send_message(message.channel, error)
|
await client.send_message(message.channel, error)
|
||||||
else:
|
else:
|
||||||
await client.send_message(message.channel, "`!meme id;text1;text2 | !meme help for full list`")
|
await client.send_message(message.channel, "`" + settings["PREFIX"] + "meme id;text1;text2 | " + settings["PREFIX"] + "meme help for full list`")
|
||||||
else:
|
else:
|
||||||
await client.send_message(message.channel, "`!meme id;text1;text2 | !meme help for full list`")
|
await client.send_message(message.channel, "`" + settings["PREFIX"] + "meme id;text1;text2 | " + settings["PREFIX"] + "meme help for full list`")
|
||||||
|
|
||||||
async def urban(message):
|
async def urban(message):
|
||||||
msg = message.content.split()
|
msg = message.content.split()
|
||||||
@ -1045,7 +1056,7 @@ async def urban(message):
|
|||||||
else:
|
else:
|
||||||
await client.send_message(message.channel, "`Invalid search.`")
|
await client.send_message(message.channel, "`Invalid search.`")
|
||||||
else:
|
else:
|
||||||
await client.send_message(message.channel, "`!urban [text]`")
|
await client.send_message(message.channel, "`" + settings["PREFIX"] + "urban [text]`")
|
||||||
|
|
||||||
async def gif(message):
|
async def gif(message):
|
||||||
msg = message.content.split()
|
msg = message.content.split()
|
||||||
@ -1067,7 +1078,7 @@ async def gif(message):
|
|||||||
else:
|
else:
|
||||||
await client.send_message(message.channel, "`Invalid search.`")
|
await client.send_message(message.channel, "`Invalid search.`")
|
||||||
else:
|
else:
|
||||||
await client.send_message(message.channel, "`!gif [text]`")
|
await client.send_message(message.channel, "`" + settings["PREFIX"] + "gif [text]`")
|
||||||
|
|
||||||
async def avatar(message):
|
async def avatar(message):
|
||||||
if message.mentions:
|
if message.mentions:
|
||||||
@ -1082,7 +1093,7 @@ async def avatar(message):
|
|||||||
else:
|
else:
|
||||||
await client.send_message(message.channel, "`User not found.`")
|
await client.send_message(message.channel, "`User not found.`")
|
||||||
else:
|
else:
|
||||||
await client.send_message(message.channel, "`!avatar [name or mention]`")
|
await client.send_message(message.channel, "`" + settings["PREFIX"] + "avatar [name or mention]`")
|
||||||
|
|
||||||
|
|
||||||
def getTriviabyChannel(channel):
|
def getTriviabyChannel(channel):
|
||||||
@ -1101,9 +1112,9 @@ async def roll(message):
|
|||||||
else:
|
else:
|
||||||
await client.send_message(message.channel, "{} `A number between 1 and 99999, maybe? :)`".format(message.author.mention))
|
await client.send_message(message.channel, "{} `A number between 1 and 99999, maybe? :)`".format(message.author.mention))
|
||||||
else:
|
else:
|
||||||
await client.send_message(message.channel, "`!roll [number]`")
|
await client.send_message(message.channel, "`" + settings["PREFIX"] + "roll [number]`")
|
||||||
else:
|
else:
|
||||||
await client.send_message(message.channel, "`!roll [number]`")
|
await client.send_message(message.channel, "`" + settings["PREFIX"] + "roll [number]`")
|
||||||
|
|
||||||
async def checkFilter(message): #WIP
|
async def checkFilter(message): #WIP
|
||||||
msg = message.content.lower()
|
msg = message.content.lower()
|
||||||
@ -1153,7 +1164,7 @@ async def twitchCheck(message):
|
|||||||
except:
|
except:
|
||||||
await client.send_message(message.channel, "{} `Error.`".format(message.author.mention))
|
await client.send_message(message.channel, "{} `Error.`".format(message.author.mention))
|
||||||
else:
|
else:
|
||||||
await client.send_message(message.channel, "{} `!twitch [name]`".format(message.author.mention))
|
await client.send_message(message.channel, "{} `".format(message.author.mention) + settings["PREFIX"] + "twitch [name]`")
|
||||||
|
|
||||||
async def triviaList(message):
|
async def triviaList(message):
|
||||||
await client.send_message(message.author, trivia_help)
|
await client.send_message(message.author, trivia_help)
|
||||||
@ -1226,10 +1237,11 @@ async def playVideo(message):
|
|||||||
|
|
||||||
async def playPlaylist(message, sing=False):
|
async def playPlaylist(message, sing=False):
|
||||||
global musicPlayer, currentPlaylist
|
global musicPlayer, currentPlaylist
|
||||||
|
p = settings["PREFIX"]
|
||||||
msg = message.content
|
msg = message.content
|
||||||
toDelete = None
|
toDelete = None
|
||||||
if not sing:
|
if not sing:
|
||||||
if msg != "!play" or msg != "play ":
|
if msg != p + "play" or msg != "play ":
|
||||||
if await checkVoice(message):
|
if await checkVoice(message):
|
||||||
msg = message.content[6:]
|
msg = message.content[6:]
|
||||||
if dataIO.fileIO("playlists/" + msg + ".txt", "check"):
|
if dataIO.fileIO("playlists/" + msg + ".txt", "check"):
|
||||||
@ -1266,6 +1278,7 @@ async def playPlaylist(message, sing=False):
|
|||||||
|
|
||||||
async def playLocal(message):
|
async def playLocal(message):
|
||||||
global currentPlaylist
|
global currentPlaylist
|
||||||
|
p = settings["PREFIX"]
|
||||||
msg = message.content.split(" ")
|
msg = message.content.split(" ")
|
||||||
if await checkVoice(message):
|
if await checkVoice(message):
|
||||||
if len(msg) == 2:
|
if len(msg) == 2:
|
||||||
@ -1283,11 +1296,11 @@ async def playLocal(message):
|
|||||||
await asyncio.sleep(2)
|
await asyncio.sleep(2)
|
||||||
await currentPlaylist.songSwitcher()
|
await currentPlaylist.songSwitcher()
|
||||||
else:
|
else:
|
||||||
await client.send_message(message.channel, "`There is no local playlist called {}. !local or !locallist to receive the list.`".format(msg[1]))
|
await client.send_message(message.channel, "`There is no local playlist called {}. " + p + "local or " + p + "locallist to receive the list.`".format(msg[1]))
|
||||||
else:
|
else:
|
||||||
await client.send_message(message.channel, "`There are no valid playlists in the localtracks folder.`")
|
await client.send_message(message.channel, "`There are no valid playlists in the localtracks folder.`")
|
||||||
else:
|
else:
|
||||||
await client.send_message(message.channel, "`!local [playlist]`")
|
await client.send_message(message.channel, "`" + settings["PREFIX"] + "local [playlist]`")
|
||||||
|
|
||||||
def getLocalPlaylists():
|
def getLocalPlaylists():
|
||||||
dirs = []
|
dirs = []
|
||||||
@ -1359,7 +1372,7 @@ async def transferPlaylist(message):
|
|||||||
dataIO.fileIO("playlists/" + msg["filename"], "save", data)
|
dataIO.fileIO("playlists/" + msg["filename"], "save", data)
|
||||||
await client.send_message(message.channel, "`Playlist added. Name: {}`".format(msg["filename"].replace(".txt", "")))
|
await client.send_message(message.channel, "`Playlist added. Name: {}`".format(msg["filename"].replace(".txt", "")))
|
||||||
else:
|
else:
|
||||||
await client.send_message(message.channel, "`Something is wrong with the playlist or its filename. Type !audio help to read how to format it properly.`")
|
await client.send_message(message.channel, "`Something is wrong with the playlist or its filename. Type " + settings["PREFIX"] + "audio help to read how to format it properly.`")
|
||||||
else:
|
else:
|
||||||
await client.send_message(message.channel, "`A playlist with that name already exists. Change the filename and resubmit it.`")
|
await client.send_message(message.channel, "`A playlist with that name already exists. Change the filename and resubmit it.`")
|
||||||
|
|
||||||
@ -1409,7 +1422,7 @@ async def addPlaylist(message):
|
|||||||
await client.send_message(message.channel, "`Something is wrong with the playlist's link or its filename. Remember, the name must be with only numbers, letters and underscores. Link must be this format: https://www.youtube.com/playlist?list=PLe8jmEHFkvsaDOOWcREvkgFoj6MD0pXXX`")
|
await client.send_message(message.channel, "`Something is wrong with the playlist's link or its filename. Remember, the name must be with only numbers, letters and underscores. Link must be this format: https://www.youtube.com/playlist?list=PLe8jmEHFkvsaDOOWcREvkgFoj6MD0pXXX`")
|
||||||
|
|
||||||
else:
|
else:
|
||||||
await client.send_message(message.channel, "`!addplaylist [name] [link]`")
|
await client.send_message(message.channel, "`" + settings["PREFIX"] + "addplaylist [name] [link]`")
|
||||||
|
|
||||||
async def delPlaylist(message):
|
async def delPlaylist(message):
|
||||||
msg = message.content.split(" ")
|
msg = message.content.split(" ")
|
||||||
@ -1425,7 +1438,7 @@ async def delPlaylist(message):
|
|||||||
else:
|
else:
|
||||||
await client.send_message(message.channel, "`There is no playlist with that name.`")
|
await client.send_message(message.channel, "`There is no playlist with that name.`")
|
||||||
else:
|
else:
|
||||||
await client.send_message(message.channel, "`!delplaylist [name]`")
|
await client.send_message(message.channel, "`" + settings["PREFIX"] + "delplaylist [name]`")
|
||||||
|
|
||||||
async def getSongTitle(message):
|
async def getSongTitle(message):
|
||||||
title = await youtubeparser.getTitle(currentPlaylist.playlist[currentPlaylist.current])
|
title = await youtubeparser.getTitle(currentPlaylist.playlist[currentPlaylist.current])
|
||||||
@ -1458,7 +1471,7 @@ async def removeFromFavorites(message):
|
|||||||
else:
|
else:
|
||||||
await client.send_message(message.channel, "{} `This song isn't in your favorites.`".format(message.author.mention))
|
await client.send_message(message.channel, "{} `This song isn't in your favorites.`".format(message.author.mention))
|
||||||
else:
|
else:
|
||||||
await client.send_message(message.channel, "{} `You don't have any favorites yet. Start adding them with !addfavorite`".format(message.author.mention))
|
await client.send_message(message.channel, "{} `You don't have any favorites yet. Start adding them with " + settings["PREFIX"] + "addfavorite`".format(message.author.mention))
|
||||||
else:
|
else:
|
||||||
await client.send_message(message.channel, "{} `No song is being played`".format(message.author.mention))
|
await client.send_message(message.channel, "{} `No song is being played`".format(message.author.mention))
|
||||||
|
|
||||||
@ -1490,6 +1503,7 @@ async def sendPlaylist(message):
|
|||||||
|
|
||||||
async def setVolume(message):
|
async def setVolume(message):
|
||||||
global settings
|
global settings
|
||||||
|
p = settings["PREFIX"]
|
||||||
msg = message.content
|
msg = message.content
|
||||||
if len(msg.split(" ")) == 2:
|
if len(msg.split(" ")) == 2:
|
||||||
msg = msg.split(" ")
|
msg = msg.split(" ")
|
||||||
@ -1500,11 +1514,11 @@ async def setVolume(message):
|
|||||||
await(client.send_message(message.channel, "`Volume set. Next track will have the desired volume.`"))
|
await(client.send_message(message.channel, "`Volume set. Next track will have the desired volume.`"))
|
||||||
dataIO.fileIO("json/settings.json", "save", settings)
|
dataIO.fileIO("json/settings.json", "save", settings)
|
||||||
else:
|
else:
|
||||||
await(client.send_message(message.channel, "`Volume must be between 0 and 1. Example: !volume 0.50`"))
|
await(client.send_message(message.channel, "`Volume must be between 0 and 1. Example: " + p + "volume 0.50`"))
|
||||||
except:
|
except:
|
||||||
await(client.send_message(message.channel, "`Volume must be between 0 and 1. Example: !volume 0.15`"))
|
await(client.send_message(message.channel, "`Volume must be between 0 and 1. Example: " + p + "volume 0.15`"))
|
||||||
else:
|
else:
|
||||||
await(client.send_message(message.channel, "`Volume must be between 0 and 1. Example: !volume 0.15`"))
|
await(client.send_message(message.channel, "`Volume must be between 0 and 1. Example: " + p + "volume 0.15`"))
|
||||||
|
|
||||||
async def downloadMode(message):
|
async def downloadMode(message):
|
||||||
if isMemberAdmin(message):
|
if isMemberAdmin(message):
|
||||||
@ -1585,7 +1599,7 @@ async def addBadWords(message):
|
|||||||
dataIO.fileIO("json/filter.json", "save", badwords)
|
dataIO.fileIO("json/filter.json", "save", badwords)
|
||||||
logger.info("Saved filter words.")
|
logger.info("Saved filter words.")
|
||||||
else:
|
else:
|
||||||
await client.send_message(message.channel, "`!addwords [word1] [word2] [phrase/with/many/words] (...)`")
|
await client.send_message(message.channel, "`" + settings["PREFIX"] + "addwords [word1] [word2] [phrase/with/many/words] (...)`")
|
||||||
else:
|
else:
|
||||||
await client.send_message(message.channel, "`I don't take orders from you.`")
|
await client.send_message(message.channel, "`I don't take orders from you.`")
|
||||||
|
|
||||||
@ -1607,7 +1621,7 @@ async def removeBadWords(message):
|
|||||||
dataIO.fileIO("json/filter.json", "save", badwords)
|
dataIO.fileIO("json/filter.json", "save", badwords)
|
||||||
logger.info("Saved filter words.")
|
logger.info("Saved filter words.")
|
||||||
else:
|
else:
|
||||||
await client.send_message(message.channel, "`!removewords [word1] [word2] [phrase/with/many/words](...)`")
|
await client.send_message(message.channel, "`" + settings["PREFIX"] + "removewords [word1] [word2] [phrase/with/many/words](...)`")
|
||||||
else:
|
else:
|
||||||
await client.send_message(message.channel, "`I don't take orders from you.`")
|
await client.send_message(message.channel, "`I don't take orders from you.`")
|
||||||
|
|
||||||
@ -1621,7 +1635,7 @@ async def changeName(message):
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(e)
|
logger.error(e)
|
||||||
else:
|
else:
|
||||||
await client.send_message(message.channel, "`!name [new name]`")
|
await client.send_message(message.channel, "`" + settings["PREFIX"] + "name [new name]`")
|
||||||
else:
|
else:
|
||||||
await client.send_message(message.channel, "`I don't take orders from you.`")
|
await client.send_message(message.channel, "`I don't take orders from you.`")
|
||||||
|
|
||||||
@ -1663,7 +1677,7 @@ async def reloadSettings(message):
|
|||||||
await client.send_message(message.channel, "`I don't take orders from you.`")
|
await client.send_message(message.channel, "`I don't take orders from you.`")
|
||||||
|
|
||||||
async def cleanup(message):
|
async def cleanup(message):
|
||||||
errorMsg = "`!cleanup [number] !cleanup [name/mention] [number]`"
|
errorMsg = "`" + settings["PREFIX"] + "cleanup [number] " + settings["PREFIX"] + "cleanup [name/mention] [number]`"
|
||||||
if isMemberAdmin(message):
|
if isMemberAdmin(message):
|
||||||
if canDeleteMessages(message):
|
if canDeleteMessages(message):
|
||||||
try:
|
try:
|
||||||
@ -1745,7 +1759,7 @@ async def addTwitchAlert(message):
|
|||||||
dataIO.fileIO("json/twitch.json", "save", twitchStreams)
|
dataIO.fileIO("json/twitch.json", "save", twitchStreams)
|
||||||
await client.send_message(message.channel, "`I will always send an alert in this channel whenever {}'s stream is online. Use !stoptwitchalert [name] to stop it.`".format(msg[1]))
|
await client.send_message(message.channel, "`I will always send an alert in this channel whenever {}'s stream is online. Use !stoptwitchalert [name] to stop it.`".format(msg[1]))
|
||||||
else:
|
else:
|
||||||
await client.send_message(message.channel, "`!twitchalert [name]`")
|
await client.send_message(message.channel, "`" + settings["PREFIX"] + "twitchalert [name]`")
|
||||||
else:
|
else:
|
||||||
await client.send_message(message.channel, "`I don't take orders from you.`")
|
await client.send_message(message.channel, "`I don't take orders from you.`")
|
||||||
|
|
||||||
@ -1765,18 +1779,19 @@ async def removeTwitchAlert(message):
|
|||||||
return True
|
return True
|
||||||
await client.send_message(message.channel, "`There's no alert for {}'s stream in this channel.`".format(msg[1]))
|
await client.send_message(message.channel, "`There's no alert for {}'s stream in this channel.`".format(msg[1]))
|
||||||
else:
|
else:
|
||||||
await client.send_message(message.channel, "`!stoptwitchalert [name]`")
|
await client.send_message(message.channel, "`" + settings["PREFIX"] + "stoptwitchalert [name]`")
|
||||||
else:
|
else:
|
||||||
await client.send_message(message.channel, "`I don't take orders from you.`")
|
await client.send_message(message.channel, "`I don't take orders from you.`")
|
||||||
|
|
||||||
async def blacklist(message, mode):
|
async def blacklist(message, mode):
|
||||||
global blacklisted_users
|
global blacklisted_users
|
||||||
|
p = settings["PREFIX"]
|
||||||
if isMemberAdmin(message):
|
if isMemberAdmin(message):
|
||||||
if message.mentions:
|
if message.mentions:
|
||||||
m = message.mentions[0]
|
m = message.mentions[0]
|
||||||
else:
|
else:
|
||||||
if len(message.content.split(" ")) >= 2:
|
if len(message.content.split(" ")) >= 2:
|
||||||
if message.content.startswith("!blacklist"):
|
if message.content.startswith(p + "blacklist"):
|
||||||
name = message.content[11:]
|
name = message.content[11:]
|
||||||
else:
|
else:
|
||||||
name = message.content[9:]
|
name = message.content[9:]
|
||||||
@ -1800,6 +1815,46 @@ async def blacklist(message, mode):
|
|||||||
else:
|
else:
|
||||||
await client.send_message(message.channel, "`I don't take orders from you.`")
|
await client.send_message(message.channel, "`I don't take orders from you.`")
|
||||||
|
|
||||||
|
async def modifySettings(message):
|
||||||
|
global settings
|
||||||
|
if isMemberAdmin(message):
|
||||||
|
msg = message.content.split(" ")
|
||||||
|
if len(msg) == 3:
|
||||||
|
_, key, value = msg
|
||||||
|
if key.lower() == "password" or key.lower() == "email" or key.lower() == "debug_id":
|
||||||
|
await client.send_message(message.channel, "`You cannot modify EMAIL, PASSWORD or DEBUG_ID`")
|
||||||
|
return False
|
||||||
|
if key.lower() == "prefix" and len(value) != 1:
|
||||||
|
await client.send_message(message.channel, "`Prefix cannot be more than one character.`")
|
||||||
|
return False
|
||||||
|
if key in settings.keys():
|
||||||
|
if value.lower() == "true": value = True
|
||||||
|
elif value.lower() == "false": value = False
|
||||||
|
else:
|
||||||
|
try:
|
||||||
|
value = int(value)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
settings[key] = value
|
||||||
|
dataIO.fileIO("json/settings.json", "save", settings)
|
||||||
|
loadHelp()
|
||||||
|
if "economy" in modules:
|
||||||
|
economy.settings = settings
|
||||||
|
economy.loadHelp()
|
||||||
|
await client.send_message(message.channel, "`'{}' set to '{}'`".format(key, str(value)))
|
||||||
|
else:
|
||||||
|
await client.send_message(message.channel, "`That setting doesn't exist`")
|
||||||
|
else:
|
||||||
|
msg = "```"
|
||||||
|
for k, v in settings.items():
|
||||||
|
if k != "EMAIL" and k != "PASSWORD":
|
||||||
|
msg += k + ": " + str(v) + "\n"
|
||||||
|
msg += "```\n"
|
||||||
|
msg += settings["PREFIX"] + "setting [setting] [value]"
|
||||||
|
await client.send_message(message.channel, msg)
|
||||||
|
else:
|
||||||
|
await client.send_message(message.channel, "`I don't take orders from you.`")
|
||||||
|
|
||||||
################################################
|
################################################
|
||||||
|
|
||||||
@asyncio.coroutine
|
@asyncio.coroutine
|
||||||
@ -1924,6 +1979,12 @@ def loadDataFromFiles(loadsettings=False):
|
|||||||
global settings
|
global settings
|
||||||
settings = dataIO.fileIO("json/settings.json", "load")
|
settings = dataIO.fileIO("json/settings.json", "load")
|
||||||
|
|
||||||
|
loadHelp()
|
||||||
|
|
||||||
|
if "economy" in modules:
|
||||||
|
economy.settings = settings
|
||||||
|
economy.loadHelp()
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
global ball, greetings, greetings_caps, stopwatches, trivia_sessions, message, gameSwitcher, uptime_timer, musicPlayer, currentPlaylist
|
global ball, greetings, greetings_caps, stopwatches, trivia_sessions, message, gameSwitcher, uptime_timer, musicPlayer, currentPlaylist
|
||||||
global logger, settings, poll_sessions
|
global logger, settings, poll_sessions
|
||||||
@ -1956,7 +2017,7 @@ def main():
|
|||||||
gameSwitcher = botPlays()
|
gameSwitcher = botPlays()
|
||||||
|
|
||||||
if "economy" in modules:
|
if "economy" in modules:
|
||||||
economy.initialize(client)
|
economy.client = client
|
||||||
|
|
||||||
uptime_timer = int(time.perf_counter())
|
uptime_timer = int(time.perf_counter())
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user