Updated readme, cleaned up code

This commit is contained in:
Twentysix 2016-08-11 23:44:49 +02:00
parent bab4eb10f8
commit d1db34a9c4
3 changed files with 13 additions and 19 deletions

View File

@ -1,6 +1,6 @@
# Red - A fully customizable Discord bot # Red - A fully customizable Discord bot
#### *Music, admin, trivia, fun commands and much more!* #### *Music, admin, trivia, fun commands and much more!*
[<img src="https://img.shields.io/badge/Support-me!-orange.svg">](https://www.patreon.com/Twentysix26) [<img src="https://img.shields.io/badge/discord-py-blue.svg">](https://github.com/Rapptz/discord.py) [<img src="https://discordapp.com/api/servers/133049272517001216/widget.png?style=banner5">](https://discord.gg/0k4npTwMvTpv9wrh) [<img src="https://img.shields.io/badge/Support-me!-orange.svg">](https://www.patreon.com/Twentysix26) [<img src="https://img.shields.io/badge/discord-py-blue.svg">](https://github.com/Rapptz/discord.py) [<img src="https://discordapp.com/api/guilds/133049272517001216/widget.png?style=banner5">](https://discord.gg/0k4npTwMvTpv9wrh)
Red is a fully modular bot which comes with sets of features/commands that can be enabled/disabled to your liking, making it customizable exactly how you want. Red is a fully modular bot which comes with sets of features/commands that can be enabled/disabled to your liking, making it customizable exactly how you want.
You can turn Red into a trivia bot, an admin bot, a music bot (...) or all of these together. You can turn Red into a trivia bot, an admin bot, a music bot (...) or all of these together.

View File

@ -47,10 +47,10 @@ class General:
""" """
author = ctx.message.author author = ctx.message.author
if number > 1: if number > 1:
n = str(randint(1, number)) n = randint(1, number)
return await self.bot.say("{} :game_die: {} :game_die:".format(author.mention, n)) await self.bot.say("{} :game_die: {} :game_die:".format(author.mention, n))
else: else:
return await self.bot.say("{} Maybe higher than 1? ;P".format(author.mention)) await self.bot.say("{} Maybe higher than 1? ;P".format(author.mention))
@commands.command(pass_context=True) @commands.command(pass_context=True)
async def flip(self, ctx, user : discord.Member=None): async def flip(self, ctx, user : discord.Member=None):
@ -71,9 +71,9 @@ class General:
tran = "∀qƆpƎℲפHIſʞ˥WNOԀQᴚS┴∩ΛMX⅄Z" tran = "∀qƆpƎℲפHIſʞ˥WNOԀQᴚS┴∩ΛMX⅄Z"
table = str.maketrans(char, tran) table = str.maketrans(char, tran)
name = name.translate(table) name = name.translate(table)
return await self.bot.say(msg + "(╯°□°)╯︵ " + name[::-1]) await self.bot.say(msg + "(╯°□°)╯︵ " + name[::-1])
else: else:
return await self.bot.say("*flips a coin and... " + randchoice(["HEADS!*", "TAILS!*"])) await self.bot.say("*flips a coin and... " + randchoice(["HEADS!*", "TAILS!*"]))
@commands.command(pass_context=True) @commands.command(pass_context=True)
async def rps(self, ctx, choice : str): async def rps(self, ctx, choice : str):
@ -108,16 +108,15 @@ class General:
await self.bot.say("Choose rock, paper or scissors.") await self.bot.say("Choose rock, paper or scissors.")
@commands.command(name="8", aliases=["8ball"]) @commands.command(name="8", aliases=["8ball"])
async def _8ball(self, *question): async def _8ball(self, *, question : str):
"""Ask 8 ball a question """Ask 8 ball a question
Question must end with a question mark. Question must end with a question mark.
""" """
question = " ".join(question)
if question.endswith("?") and question != "?": if question.endswith("?") and question != "?":
return await self.bot.say("`" + randchoice(self.ball) + "`") await self.bot.say("`" + randchoice(self.ball) + "`")
else: else:
return await self.bot.say("That doesn't look like a question.") await self.bot.say("That doesn't look like a question.")
@commands.command(aliases=["sw"], pass_context=True) @commands.command(aliases=["sw"], pass_context=True)
async def stopwatch(self, ctx): async def stopwatch(self, ctx):
@ -129,7 +128,7 @@ class General:
else: else:
tmp = abs(self.stopwatches[author.id] - int(time.perf_counter())) tmp = abs(self.stopwatches[author.id] - int(time.perf_counter()))
tmp = str(datetime.timedelta(seconds=tmp)) tmp = str(datetime.timedelta(seconds=tmp))
await self.bot.say(author.mention + " Stopwatch stopped! Time: **" + str(tmp) + "**") await self.bot.say(author.mention + " Stopwatch stopped! Time: **" + tmp + "**")
self.stopwatches.pop(author.id, None) self.stopwatches.pop(author.id, None)
@commands.command() @commands.command()

7
red.py
View File

@ -21,9 +21,7 @@ import traceback
# https://github.com/Rapptz/RoboDanny/tree/async # https://github.com/Rapptz/RoboDanny/tree/async
# #
description = """ description = "Red - A multifunction Discord bot by Twentysix"
Red - A multifunction Discord bot by Twentysix
"""
formatter = commands.HelpFormatter(show_check_failure=False) formatter = commands.HelpFormatter(show_check_failure=False)
@ -32,8 +30,6 @@ bot = commands.Bot(command_prefix=["_"], formatter=formatter,
settings = Settings() settings = Settings()
from cogs.utils import checks
@bot.event @bot.event
async def on_ready(): async def on_ready():
@ -367,7 +363,6 @@ def load_cogs():
def main(): def main():
global settings global settings
global checks
check_folders() check_folders()
check_configs() check_configs()