Exemple #1
0
 async def colorset(self, ctx, hex):
     hex = hex.replace("#", "")
     match = re.search(r'^(?:[0-9a-fA-F]{3}){1,2}$', hex)
     if match:
         with open('files/{}.json'.format(ctx.guild.id), 'r') as f:
             color = json.load(f)
         color["info"]["color"] = "0x" + hex
         with open('files/{}.json'.format(ctx.guild.id), 'w') as f:
             f.truncate()
             json.dump(color, f, indent=4)
         colorPriv = int(get_color(bot, ctx.message))
         embed = discord.Embed(title="Color settings!",
                               colour=discord.Color(colorPriv))
         embed.add_field(name="Your new color:", value="hex")
         embed.set_thumbnail(
             url="http://www.singlecolorimage.com/get/{}/100x100".format(
                 hex))
         await ctx.send(embed=embed)
     else:
         color = int(get_color(bot, ctx.message))
         embed = discord.Embed(title="Error:", colour=discord.Colour(color))
         embed.add_field(name="Not a valid hex code!",
                         value="Please try again!")
         message = await ctx.send(embed=embed)
         await asyncio.sleep(5)
         await message.delete()
Exemple #2
0
 async def dis(self, ctx, arg1: str, *arg2: str):
     now = ar.utcnow()
     color = int(get_color(bot, ctx.message))
     prefix = get_prefix(bot, ctx.message)
     if arg1 == "help":
         embed = discord.Embed(title="**`dis` help!**",
                               colour=discord.Colour(color))
         embed.add_field(
             name="Help is here!",
             value="Correct format is `{0}dis DD/MM/YYY`".format(prefix))
         await ctx.send(embed=embed)
         return
     color = int(get_color(bot, ctx.message))
     try:
         startDateParsed = ar.get(arg1, 'DD/MM/YYYY')
     except ar.ParserError:
         try:
             startDateParsed = ar.get(arg1, 'D/M/YYYY')
         except:
             prefix = get_prefix(bot, ctx.message)
             color = int(get_color(bot, ctx.message))
             embed = discord.Embed(title="Error!",
                                   colour=discord.Colour(color))
             embed.add_field(
                 name=">:(",
                 value="Correct format is `{0}dis DD/MM/YYYY`".format(
                     prefix))
             embed.set_footer(text="Type `{0}help`!".format(prefix))
             await ctx.send(embed=embed)
     string, date = difference(self, startDateParsed, arg2)
     embed = discord.Embed(title="Days until: {0}".format(date),
                           colour=discord.Colour(color))
     embed.add_field(name="⏰", value=string)
     await ctx.send(embed=embed)
     '''
Exemple #3
0
 async def tzset(self, ctx, *args):
     input = " ".join(args)
     region, formatted = getRegion(self, input)
     user = ctx.message.author
     print(input)
     prefix = get_prefix(bot, ctx.message)
     color = int(get_color(bot, ctx.message))
     if input == "help":
         embed = discord.Embed(title="**`tzset` help!**",
                               colour=discord.Colour(color))
         embed.add_field(
             name="🌍 🌍 🌍",
             value=
             "Set your location with `{}tzset DATE`, or check someone's timezone or the timezone in a location with `{}tz INPUT`"
             .format(prefix, prefix))
         await ctx.send(embed=embed)
         return
     with open('files/{}.json'.format(ctx.guild.id), 'r+') as file:
         addData = {"users": {str(user.id): region}}
         data = json.load(file)
         data.update(addData)
         file.seek(0)
         file.truncate()
         json.dump(data, file, indent=4)
     color = int(get_color(bot, ctx.message))
     embed = discord.Embed(title="**Timezone set!**",
                           colour=discord.Colour(color))
     embed.add_field(name="🌍🌍🌍",
                     value="Timezone for <@{0}> is set to {1}".format(
                         ctx.message.author.id, region))
     embed.set_footer(
         text=
         "For your security, we only save your timezone in terms of general regions, which is why it may not list your city. If the location is incorrect, try a different city in your timezone."
     )
     await ctx.send(embed=embed)
Exemple #4
0
 async def remind(self, ctx, *arg):
     global userSend
     prefix = get_prefix(bot, ctx.message)
     command = []
     color = int(get_color(bot, ctx.message))
     prefix = get_prefix(bot, ctx.message)
     i = 0
     if len(arg) == 1:
         embed = discord.Embed(title="Reminder help!",
                               colour=discord.Colour(color))
         embed.add_field(
             name="Correct syntax:",
             value=
             "`{}?remind \"message\" time`\ne.g. `{}remind \"Your message here\" 1 week 10 hours 3 minutes`"
             .format(prefix, prefix))
         message = await ctx.send(embed=embed)
     if type(arg[i]) == discord.Member:
         userSend = discord.Member
         i += 1
         print(arg[i])
     else:
         userSend = ctx.message.author
     message = arg[i]
     print(arg[i])
     i += 1
     arg = list(arg)
     del (arg[:i])
     print(arg)
     for args in arg:
         command.append(args)
     args = 0
     length = len(command)
     i = 0
     arguments = []
     timeAdd = 0
     timeNow = ar.utcnow()
     timeCreated = timeNow.format("MMMM Do, YYYY [at] HH:mm")
     while i < (length - 1):
         additional = formatToMin(self, command[i + 1], int(command[i]))
         timeAdd += additional
         i += 2
     dictToSend = dict({
         "timeAdd": timeAdd,
         "user": userSend.id,
         "timeCreated": timeCreated,
         "message": message
     })
     await addToLoop(self, dictToSend)
     color = int(get_color(bot, ctx.message))
     embed = discord.Embed(title="⏲ Your reminder is set! ⏲",
                           colour=discord.Colour(color))
     embed.add_field(name="You will be reminded in:",
                     value=str(timeAdd) + " minutes")
     embed.add_field(name="Your message is:", value=message)
     await ctx.send(embed=embed)
Exemple #5
0
 async def bdayset(self, ctx, *args):
     color = int(get_color(bot, ctx.message))
     prefix = get_prefix(bot, ctx.message)
     if args[0] == "help":
         embed = discord.Embed(title="**`bdayset` help!**", colour=discord.Colour(color))
         embed.add_field(name="Help is here!", value="The correct command is `{0}bdayset MONTH DAY`. If you'd like to check someone's birthday, use `{0}bday USER`".format(prefix))
         await ctx.send(embed=embed)
         return
     if len(args) == 0:
         embed = discord.Embed(title="Error!", colour=discord.Colour(color))
         embed.add_field(name=">:(", value="The correct command is `{0}bdayset MONTH DAY`. If you'd like to check someone's birthday, use `{0}bday USER`".format(prefix))
         embed.set_footer(text="Type `{0}help`".format(prefix))
         await ctx.send(embed = embed)    
     user = ctx.message.author
     combined = " ".join(args) # i.e. 3 Jan
     try:
         if len(args[0]) > 3:
             date = arrow.get(combined, "MMMM D")
             writeFile(combined, ctx, user)
             embed = discord.Embed(title="Birthday set!", colour=discord.Colour(color))
             embed.add_field(name="🎂🎂🎂", value="Set to: **{0}**".format(date.format("MMMM Do")))
             await user.send(embed = embed)
         elif len(args[0]) == 3:
             date = arrow.get(combined, "MMM D")
             writeFile(combined, ctx, user)
             embed = discord.Embed(title="Birthday set!", colour=discord.Colour(color))
             embed.add_field(name="🎂🎂🎂", value="Set to: **{0}**".format(date.format("MMMM Do")))
             await user.send(embed = embed)
     except ValueError:
         embed = discord.Embed(title="Birthday error!", colour=discord.Colour(color))
         embed.add_field(name=">:(", value="Please try again, or type `{}help`".format(prefix))
         await user.send(embed = embed)
Exemple #6
0
 async def bday_error(self, ctx, error):
     prefix = get_prefix(bot, ctx.message)
     color = int(get_color(bot, ctx.message))
     embed = discord.Embed(title="Error!", colour=discord.Colour(color))
     embed.add_field(name=">:(", value="The correct command is `{0}bday USER`. If you'd like to set your birthday, use `{0}bdayset MONTH DAY`".format(prefix))
     embed.set_footer(text="Type `{0}help`".format(prefix))
     await ctx.send(embed = embed)    
Exemple #7
0
 async def birthday(self, ctx):
     color = int(get_color(bot, ctx.message))
     prefix = get_prefix(bot, ctx.message)
     embed = discord.Embed(title="Help is here!", colour=color)
     embed.add_field(name=" __**Birthday Commands:**__",
                     value=birthdayString.format(prefix))
     await ctx.send(embed=embed)
Exemple #8
0
 async def support(self, ctx):
     color = int(get_color(bot, ctx.message))
     prefix = get_prefix(bot, ctx.message)
     embed = discord.Embed(title="Thank you!", colour=color)
     embed.add_field(name=" __**Support me:**__",
                     value=supportString.format(prefix))
     await ctx.send(embed=embed)
Exemple #9
0
 async def prefix(self, ctx, *args):
     color = int(get_color(bot, ctx.message))
     if args:
         with open('files/{}.json'.format(ctx.guild.id), 'r') as f:
             prefixes = json.load(f)
         prefixes["info"]["prefix"] = args[0]
         with open('files/{}.json'.format(ctx.guild.id), 'w') as f:
             f.truncate()
             json.dump(prefixes, f, indent=4)
         prefix = get_prefix(bot, ctx.message)
         username = "******".format(prefix)
         await ctx.guild.get_member(717002097790550038).edit(nick=username)
         embed = discord.Embed(title="Prefix has been changed!",
                               colour=discord.Color(color))
         embed.add_field(
             name="Your prefix has been updated!".format(prefix),
             value="The prefix for Timely is now: `{}`".format(prefix))
         await ctx.send(embed=embed)
     else:
         prefix = get_prefix(bot, ctx.message)
         embed = discord.Embed(title="Prefix settings!",
                               colour=discord.Color(color))
         embed.add_field(
             name="Your current prefix is **{}**".format(prefix),
             value="Set a new prefix with `{}prefix PREFIX`".format(prefix))
         await ctx.send(embed=embed)
Exemple #10
0
 async def cancel_error(self, ctx, error):
     prefix = get_prefix(bot, ctx.message)
     color = int(get_color(bot, ctx.message))
     embed = discord.Embed(title="Error!", colour=discord.Colour(color))
     embed.add_field(
         name=">:(",
         value="Please try again, or type `{}help`".format(prefix))
     await ctx.send(embed=embed)
Exemple #11
0
 async def hltb(self, ctx, *args):
     prefix = get_prefix(bot, ctx.message)
     if args[0] == "help":
         embed = discord.Embed(title="**`hltb` help!**",
                               colour=discord.Colour(color))
         embed.add_field(
             name="Help is here!",
             value="Correct format is `{0}hltb VIDEOGAME`".format(prefix))
         await ctx.send(embed=embed)
         return
     color = int(get_color(bot, ctx.message))
     search = (" ".join(args))
     results = await HowLongToBeat().async_search(search)
     if results is not None and len(results) > 0:
         best_element = max(results, key=lambda element: element.similarity)
         name = best_element.game_name
         image = best_element.game_image_url
         gameplayMain = best_element.gameplay_main
         gameplayMainUnit = best_element.gameplay_main_unit
         gameplayMainLabel = best_element.gameplay_main_label
         gameplayMainExtra = best_element.gameplay_main_extra
         gameplayMainExtraUnit = best_element.gameplay_main_extra_unit
         gameplayMainExtraLabel = best_element.gameplay_main_extra_label
         gameplayCompletionist = best_element.gameplay_completionist
         gameplayCompletionistUnit = best_element.gameplay_completionist_unit
         gameplayCompletionistLabel = best_element.gameplay_completionist_label
         mainString = "It will take **{0} {1}** to beat {2}".format(
             gameplayMain, gameplayMainUnit, gameplayMainLabel)
         mainExtraString = "It will take **{0} {1}** to beat {2}".format(
             gameplayMainExtra, gameplayMainExtraUnit,
             gameplayMainExtraLabel)
         completionsitString = "It will take **{0} {1}** to beat {2}".format(
             gameplayCompletionist, gameplayCompletionistUnit,
             gameplayCompletionistLabel)
         embed = discord.Embed(title="**How Long to Beat {}**".format(name),
                               colour=discord.Colour(color))
         embed.set_thumbnail(url=image)
         embed.add_field(name="🕹🕹🕹",
                         value="{0} \n{1} \n{2}".format(
                             mainString, mainExtraString,
                             completionsitString))
         embed.set_footer(
             text="Many thanks to the howlongtobeatpy library for the data."
         )
         await ctx.send(embed=embed)
     else:
         embed = discord.Embed(title="**Search Error**",
                               colour=discord.Color(color))
         prefix = get_prefix(bot, ctx.message)
         embed.add_field(
             name="_**Please try again!**_",
             value=
             "Your query returned no significant data. Please try again! \n \nExample: `{0}hltb Undertale`"
             .format(prefix))
         message = await ctx.send(embed=embed)
         await asyncio.sleep(5)
         await message.delete()
Exemple #12
0
 async def messages_error(self, ctx, error):
     color = int(get_color(bot, ctx.message))
     prefix = get_prefix(bot, ctx.message)
     embed = discord.Embed(title="Whoops!", colour=discord.Colour(color))
     embed.add_field(name="There's been an error",
                     value="Please type `{0}help`".format(prefix))
     await ctx.send(embed=embed)
     await asyncio.sleep(5)
     await message.delete()
Exemple #13
0
 async def distance(self, ctx):
     color = int(get_color(bot, ctx.message))
     prefix = get_prefix(bot, ctx.message)
     embed = discord.Embed(title="**`dis` help!**",
                           colour=discord.Colour(color))
     embed.add_field(
         name="Help is here!",
         value="Correct format is `{0}dis DD/MM/YYY`".format(prefix))
     await ctx.send(embed=embed)
Exemple #14
0
 async def timer_error(self, ctx, error):
     color = int(get_color(bot, ctx.message))
     embed = discord.Embed(title="**Syntax Error**",
                           colour=discord.Color(color))
     prefix = get_prefix(bot, ctx.message)
     embed.add_field(name="_**Please try again!**_",
                     value="Example: \n`{}timer 10 seconds`".format(prefix))
     message = await ctx.send(embed=embed)
     await asyncio.sleep(5)
     await message.delete()
Exemple #15
0
 async def qr(self, ctx, *args):
     color = int(get_color(bot, ctx.message))
     args = "%20".join(args)
     prefix = get_prefix(bot, ctx.message)
     if args[0] == "help":
         embed = discord.Embed(title="**`qr` help!**",
                               colour=discord.Colour(color))
         embed.add_field(
             name="Help is here!",
             value="Correct format is `{0}qr MESSAGE`".format(prefix))
         await ctx.send(embed=embed)
         return
     color = int(get_color(bot, ctx.message))
     url = "http://api.qrserver.com/v1/create-qr-code/?data={}&size=250x250".format(
         args)
     embed = discord.Embed(title="QR Generator:",
                           colour=discord.Colour(color))
     embed.set_image(url=url)
     embed.set_footer(text="Thanks to QRServer for the API!")
     await ctx.send(embed=embed)
Exemple #16
0
 async def movie_error(self, ctx, error):
     color = int(get_color(bot, ctx.message))
     prefix = get_prefix(bot, ctx.message)
     embed = discord.Embed(title="Movie search error >:(",
                           colour=discord.Colour(color))
     embed.add_field(
         name="🎞🎞🎞🎞🎞🎞",
         value=
         "**Please retry with a different search input!** \n Syntax is: `{0}movie` `query`"
         .format(prefix))
     await ctx.send(embed=embed)
Exemple #17
0
 async def qr_error(self, ctx):
     color = int(get_color(bot, ctx.message))
     prefix = get_prefix(bot, ctx.message)
     embed = discord.Embed(title="**`qr` help!**",
                           colour=discord.Colour(color))
     embed.add_field(
         name="Help is here!",
         value="Correct format is `{0}qr MESSAGE`".format(prefix))
     message = await ctx.send(embed=embed)
     await asyncio.sleep(5)
     await message.delete()
Exemple #18
0
 async def dddddsetup_error(self, ctx, error):
     if isinstance(error, commands.MissingRequiredArgument):
         color = int(get_color(bot, ctx.message))
         embed = discord.Embed(title="**Argument error**",
                               colour=discord.Colour(color))
         embed.add_field(
             name="Possible arguments:",
             value=
             "`role` - creates role for bot, only needed for initialization."
         )
         await ctx.send(embed=embed)
Exemple #19
0
 async def utility(self, ctx):
     color = int(get_color(bot, ctx.message))
     prefix = get_prefix(bot, ctx.message)
     embed = discord.Embed(title="Help is here!", colour=color)
     embed.add_field(name=" __**Utility Commands:**__",
                     value=utilityString.format(prefix))
     embed.set_footer(
         text=
         "Only users with Admin permissions can run these commands. Sorry normies."
     )
     await ctx.send(embed=embed)
Exemple #20
0
 async def friendship(self, ctx):
     user = ctx.message.author
     color = int(get_color(bot, ctx.message))
     embed = discord.Embed(title="Wanna be friends?",
                           colour=discord.Colour(color))
     embed.add_field(
         name="<3 <3 <3",
         value=
         "Just slid into your DMs! Now you can access commands from the comfort of your messages."
     )
     await user.send(embed=embed)
Exemple #21
0
 async def remind_error(self, ctx, error):
     prefix = get_prefix(bot, ctx.message)
     color = int(get_color(bot, ctx.message))
     embed = discord.Embed(title="Syntax error >:(",
                           colour=discord.Colour(color))
     embed.add_field(
         name="Correct syntax:",
         value=
         "`{}?remind @user \"message\" time`\ne.g. `{}remind @TimeVibe \"Your message here\" 1 week 10 hours 3 minutes` \n \n *`@user` field is optional if the reminder is for yourself.*"
         .format(prefix, prefix))
     message = await ctx.send(embed=embed)
     await asyncio.sleep(5)
     await message.delete()
Exemple #22
0
 async def hltb_error(self, ctx, error):
     prefix = get_prefix(bot, ctx.message)
     color = int(get_color(bot, ctx.message))
     embed = discord.Embed(title="Videogame search error >:(",
                           colour=discord.Colour(color))
     embed.add_field(
         name="🎞🎞🎞🎞🎞🎞",
         value=
         "**Please retry with a different search input!** \n Syntax is: `{}hltb Undertale`"
         .format(prefix))
     message = await ctx.send(embed=embed)
     await asyncio.sleep(5)
     await message.delete()
Exemple #23
0
 async def bday(self, ctx, user: discord.Member):
     color = int(get_color(bot, ctx.message))
     prefix = get_prefix(bot, ctx.message)
     if user == None:
         embed = discord.Embed(title="Help is here!", colour=discord.Colour(color))
         embed.add_field(name=">:(", value="The correct command is `{0}bday USER`. If you'd like to set your birthday, use `{0}bdayset MONTH DAY`".format(prefix))
         embed.set_footer(text="Type `{0}help`".format(prefix))
         await ctx.send(embed = embed)    
     userID = user.id
     userNick = user.nick
     color = int(get_color(bot, ctx.message))
     with open('files/{}.json'.format(ctx.guild.id), 'r') as file:
         try:
             data = json.load(file)
             birthday = data["usersbday"][str(userID)]
             date = birthday.capitalize()
             embed = discord.Embed(title="{0}'s Birthday:".format(userNick), colour=discord.Colour(color))
             embed.add_field(name="🎂🎂🎂", value="Their birthday is: **{0}**".format(date))
             await ctx.send(embed = embed)
         except KeyError:
             prefix = get_prefix(bot, ctx.message)
             embed = discord.Embed(title="No Birthday Set!", colour=discord.Colour(color))
             embed.add_field(name="🎂🎂🎂", value="{0} doesn't have a birthday set! Use `{1}bdayset MONTH DAY` to set it.".format(userNick, prefix))
             await ctx.send(embed = embed)
Exemple #24
0
    async def movie(self, ctx, *args):
        prefix = get_prefix(bot, ctx.message)
        if args[0] == "help":
            embed = discord.Embed(title="**`movie` help!**",
                                  colour=discord.Colour(color))
            embed.add_field(
                name="Help is here!",
                value="Correct format is `{0}movie TITLE`".format(prefix))
            await ctx.send(embed=embed)
            return
        search = ("_".join(args))
        response = requests.get(
            "http://www.omdbapi.com/?apikey={0}&t={1}".format(key, search))
        data = json.loads(response.text)
        title = data["Title"]
        released = data["Released"]
        rated = data["Rated"]
        type = data["Type"]
        runtime = data["Runtime"]
        genre = data["Genre"]
        director = data["Director"]
        plot = data["Plot"]
        awards = data["Awards"]
        poster = data["Poster"]
        metascore = data["Metascore"]
        imdbRating = data["imdbRating"]

        stringOne = """**Title:** {0}
        **Date released:** {1}
        **Age rating:** {2}
        **Runtime:** {3}
        **Genre:** {4}
        """.format(title, released, rated, runtime, genre)
        stringTwo = """**Director:** {0}
        **Plot description:** {1}
        **Awards:** {2}
        **Metascore:** {3}
        **IMDB rating:** {4}
        """.format(director, plot, awards, metascore, imdbRating)
        color = int(get_color(bot, ctx.message))
        embed = discord.Embed(title="Movie search: {}".format(title),
                              colour=discord.Colour(color))
        embed.set_thumbnail(url=poster)
        embed.add_field(name="🎞🎞🎞🎞🎞🎞",
                        value=stringOne + stringTwo,
                        inline=True)
        embed.set_footer(text="Many thanks to the OMDB library for the data.")
        await ctx.send(embed=embed)
Exemple #25
0
 async def tz(self, ctx, input):
     color = int(get_color(bot, ctx.message))
     prefix = get_prefix(bot, ctx.message)
     if input == "help":
         embed = discord.Embed(title="**`tz` help!**",
                               colour=discord.Colour(color))
         embed.add_field(
             name="🌍 🌍 🌍",
             value=
             "Set your location with `{}tzset DATE`, or check someone's timezone or the timezone in a location with `{}tz INPUT`"
             .format(prefix, prefix))
         await ctx.send(embed=embed)
         return
     elif input.startswith("<"):
         string = re.sub("<|>|@|!", "", input)
         user = await ctx.bot.fetch_user(int(string))
         embed = discord.Embed(title="**Timezone**",
                               colour=discord.Colour(color))
         with open('files/{}.json'.format(ctx.guild.id), 'r') as file:
             data = json.load(file)
             try:
                 input = data["users"][string]
             except:
                 embed = discord.Embed(title="**Timezone not set**",
                                       colour=discord.Colour(color))
                 embed.add_field(
                     name="🌍 🌍 🌍",
                     value=
                     "User {0} has not set a region! Use `{1}tzset location` to set!"
                     .format(input, prefix))
                 await ctx.send(embed=embed)
                 return
         region, formatted = getRegion(self, input)
         embed.add_field(name="Local time for **" + str(user) + "**",
                         value=formatted)
         await ctx.send(embed=embed)
         return
     else:
         region, formatted = getRegion(self, input)
         embed = discord.Embed(title="**Timezone**",
                               colour=discord.Colour(color))
         embed.add_field(name="Local time in: **" + input.capitalize() +
                         "**",
                         value=formatted)
         await ctx.send(embed=embed)
         return
Exemple #26
0
 async def data(self, ctx):
     color = int(get_color(bot, ctx.message))
     prefix = get_prefix(bot, ctx.message)
     embed = discord.Embed(title="Help is here!", colour=color)
     embed.add_field(
         name=" __**How we use your data:**__",
         value=
         """By inviting me to your server, you only allow me to access the permissions you agreed on when adding me. I only collect data which you give to me, which inclues your birthday and timezone. 
                     
                     The timezone data is saved as **general regions**, not the location you type in. 
                     
                     The birthday data saves only what you give it, and **doesn't support year of birth** for a reason.
                     
                     The messaging parsing command only temporarily reads the messages in the server, and deletes **any mention** of the messages from it's instant memory as soon as it finishes. 
                     
                     All data saved is deleted upon leaving a server. We use the same hosting servers as many other leading bots who collect far more detailed information on you. """
     )
     await ctx.send(embed=embed)
Exemple #27
0
 async def convert(self, ctx, *args):  #10 USD TO RUB or 10 USD RUB
     color = int(get_color(bot, ctx.message))
     if len(args) == 4:
         currency = args[3].upper()
     else:
         currency = args[2].upper()
     base = args[1].upper()
     response = await getAPI(self, base, currency)
     amount = int(args[0])
     final = round((amount * response), 2)
     embed = discord.Embed(title="💸💸💸",
                           colour=discord.Colour(color))
     embed.add_field(name="Converting {0} to {1}".format(base, currency),
                     value="`{0}` `{1}` in `{2}` is \n `{3} {4}`".format(
                         amount, base, currency, final, currency),
                     inline=True)
     embed.set_footer(text="Thanks to exchangeratesapi.io for the data!")
     await ctx.send(embed=embed)
Exemple #28
0
 async def convertError(self, ctx, error):
     prefix = get_prefix(bot, ctx.message)
     color = int(get_color(bot, ctx.message))
     embed = discord.Embed(title="Possible currencies:",
                           colour=discord.Colour(color))
     embed.add_field(name="Syntax",
                     value="`{}convert 10 USD to RUB`".format(prefix),
                     inline=False)
     embed.add_field(name="💸💸💸💸💸💸",
                     value=currenciesFirst,
                     inline=True)
     embed.add_field(name="💸💸💸💸💸💸",
                     value=currenciesSecond,
                     inline=True)
     embed.set_footer(text="Thanks to exchangeratesapi.io for the data!")
     message = await ctx.send(embed=embed)
     await asyncio.sleep(5)
     await message.delete()
Exemple #29
0
 async def timer(self, ctx, arg1: int, arg2: str):
     units = ""
     color = int(get_color(bot, ctx.message))
     possibleCommands = [
         "seconds", "sec", "secs", "s", "minutes", "hours", "minute",
         "hour", "m", "mins", "hr", "hrs"
     ]
     if arg2 in possibleCommands:
         units = arg2
     else:
         embed = discord.Embed(title="Timer error:",
                               colour=discord.Colour(color))
         embed.add_field(
             name="Syntax error",
             value=
             "Whoops! Syntax error. Command should be: \n ```?timer length unit``` \n Units can only be `hours`, `minutes`, or `seconds`. Please use the `?reminder` command for anything longer."
         )
         await ctx.send(embed=embed)
         return
     if arg2 in ["minutes", "minute", "m", "mins"]:
         arg1 = arg1 * 60
     elif arg2 in ["hours", "hour", "hr", "hrs"]:
         arg1 = arg1 * 3600
     totalTime = time.strftime("%H:%M:%S", time.gmtime(arg1))
     if arg1 > 43200:
         embed = discord.Embed(title="Timer too long!",
                               colour=discord.Colour(color))
         embed.add_field(
             name="Progress Bar",
             value=
             "Your timer is over 12 hours! Why don't you try the `?reminder` command instead?"
         )
         await ctx.send(embed=embed)
         return
     t = 0
     while t < arg1 + 1:
         bar_length = 20
         percent = float(t) / arg1
         arrow = '-' * int(round(percent * bar_length) - 1) + '>'
         spaces = ' ' * (bar_length - len(arrow))
         timeRemaining = time.strftime("%H:%M:%S",
                                       time.gmtime(int(arg1 - t)))
         string = ("```\rPercent: [{0}] {1}%```".format(
             arrow + spaces, int(round(percent * 100))))
         embed = discord.Embed(title="⏱: {0}".format(timeRemaining),
                               colour=discord.Colour(color))
         embed.add_field(name="⏳", value=string)
         if t == 0:
             message = await ctx.send(embed=embed)
         else:
             await message.edit(embed=embed)
         t += 1
         await asyncio.sleep(1)
         if cancelTimer == True:
             string = ("_**CANCELLED_**")
             embed = discord.Embed(title="⏱", colour=discord.Colour(color))
             embed.add_field(name="⏱", value=string)
             return
     string = ("_**FINISHED**_")
     embed = discord.Embed(title="💫🎉🎉🎉💫", colour=discord.Colour(color))
     embed.add_field(name="💫🎉🎉🎉💫", value=string)
     await message.edit(embed=embed)
Exemple #30
0
 async def help(self, ctx, *args):
     prefix = get_prefix(bot, ctx.message)
     color = int(get_color(bot, ctx.message))
     if len(args) == 0:
         embed = discord.Embed(title="Help is here!", colour=color)
         embed.add_field(name=" __**Command Categories:**__",
                         value=mainString.format(prefix))
         await ctx.send(embed=embed)
     elif args[0] == "tz":
         embed = discord.Embed(title="Help is here!", colour=color)
         embed.add_field(name=" __**Timezone Commands:**__",
                         value=tzString.format(prefix))
         await ctx.send(embed=embed)
     elif args[0] == "convert":
         embed = discord.Embed(title="Help is here!", colour=color)
         embed.add_field(name=" __**Convert Commanbds:**__",
                         value=convertString.format(prefix))
         await ctx.send(embed=embed)
     elif args[0] == "distance":
         embed = discord.Embed(title="Help is here!", colour=color)
         embed.add_field(name=" __**Distance Commands:**__",
                         value=distanceString.format(prefix))
         await ctx.send(embed=embed)
     elif args[0] == "reminder/timer":
         embed = discord.Embed(title="Help is here!", colour=color)
         embed.add_field(name=" __**Reminder/Timer Commands:**__",
                         value=reminderString.format(prefix))
         await ctx.send(embed=embed)
     elif args[0] == "birthday":
         embed = discord.Embed(title="Help is here!", colour=color)
         embed.add_field(name=" __**Birthday Commands:**__",
                         value=birthdayString.format(prefix))
         await ctx.send(embed=embed)
     elif args[0] == "fun":
         embed = discord.Embed(title="Help is here!", colour=color)
         embed.add_field(name=" __**Fun Commands:**__",
                         value=funString.format(prefix))
         await ctx.send(embed=embed)
     elif args[0] == "utility":
         embed = discord.Embed(title="Help is here!", colour=color)
         embed.add_field(name=" __**Utility Commands:**__",
                         value=utilityString.format(prefix))
         embed.set_footer(
             text=
             "Only users with Admin permissions can run these commands. Sorry normies."
         )
         await ctx.send(embed=embed)
     elif args[0] == "data":
         embed = discord.Embed(title="Help is here!", colour=color)
         embed.add_field(
             name=" __**How we use your data:**__",
             value=
             """By inviting me to your server, you only allow me to access the permissions you agreed on when adding me. I only collect data which you give to me, which inclues your birthday and timezone. 
                         
                         The timezone data is saved as **general regions**, not the location you type in. 
                         
                         The birthday data saves only what you give it, and **doesn't support year of birth** for a reason.
                         
                         The messaging parsing command only temporarily reads the messages in the server, and deletes **any mention** of the messages from it's instant memory as soon as it finishes. 
                         
                         All data saved is deleted upon leaving a server. We use the same hosting servers as many other leading bots who collect far more detailed information on you. """
         )
         await ctx.send(embed=embed)
     elif args[0] == "support":
         embed = discord.Embed(title="Help is here!", colour=color)
         embed.add_field(name=" __**Support me:**__",
                         value=supportString.format(prefix))
         await ctx.send(embed=embed)
     else:
         embed = discord.Embed(title="Help is here!", colour=color)
         embed.add_field(name=" __**Command Categories:**__",
                         value=mainString.format(prefix))
         await ctx.send(embed=embed)