Пример #1
0
 async def rate(self, ctx, number=None):
     if number:
         if not number.isdigit() and (number != "-1"): number = 100
         self.randEvent = int(number)
         await ctx.send(embed=make_embed(
             title="Rate Changed",
             description=f"Random events are now 1 in {self.randEvent}"))
     else:
         await ctx.send(embed=make_embed(
             title=f"Random Event Rate is currently 1 in {self.randEvent}"))
Пример #2
0
 async def groupUp(self, ctx, groupName, num=1):
     mJson = jsGet("groups")
     if groupName in mJson:
         if str(ctx.author.id) in mJson[groupName]:
             await self.rep(
                 ctx,
                 num=num,
                 words=
                 f"{groupName} UNITE! {listToString([i.mention for i in userGrab(self.client,mJson[groupName])],', ',' and ')}"
             )
         else:
             await ctx.send(embed=make_embed(
                 title="Can't Gather Group",
                 footer="You can't unite a group you're not in"))
     else:
         await ctx.send(embed=make_embed(title="Group Not Found",
                                         footer="Check spelling idk"))
Пример #3
0
 async def groups(self, ctx, force=False):
     if force:
         if ctx.author.id not in jsGet("admo")["admin"]:
             force = False
     mJson = jsGet("groups")
     if not force: l = [i for i in mJson if str(ctx.author.id) in mJson[i]]
     else: l = [i for i in mJson]
     await ctx.send(embed=make_embed(
         title="Your Groups", description=listToString(l, ", ", " and ")))
Пример #4
0
 async def groupDisband(self, ctx, groupName, force=False):
     if force:
         if ctx.author.id not in jsGet("admo")["admin"]:
             force = False
     mJson = jsGet("groups")
     if str(ctx.author.id) in mJson[groupName] or force:
         removed = mJson.pop(groupName, None)
         with open("groups.json", "w") as j:
             json.dump(mJson, j, indent=2, sort_keys=True)
         await ctx.send(embed=make_embed(
             title=f"\"{groupName}\" disbanded",
             description=
             f"Members were {listToString([i.mention for i in userGrab(self.client,removed)],', ',' and ')}"
         ))
     else:
         await ctx.send(embed=make_embed(
             title="Cannot Disband Group",
             footer="You can't disband a group you're not in"))
Пример #5
0
 async def redditor(self, ctx, user):
     info = self.userImageScrape(user)
     c = 5
     while (not info) and c > 5:
         info = self.userImageScrape(user)
         c -= 1
     if not info: await self.redditError(ctx, user)
     else:
         if info[3] == True and ctx.channel.is_nsfw() == False:
             await ctx.send(embed=make_embed(
                 title="Sorry, I can't send this post to a non-NSFW channel",
                 footer=
                 "Try using the command again or make the channel NSFW"))
         else:
             await ctx.send(embed=make_embed(
                 title=info[0],
                 image=info[1],
                 footer=f"Posted on r/{info[2]} by u/{info[4]}"))
Пример #6
0
 async def textpost(self, ctx, sub="copypasta"):
     c = 5
     info = self.text_Post_Scrape(sub)
     while (not info) and c > 0:
         info = self.post_Scrape(sub)
         c -= 1
     if not info: await self.redditError(ctx, sub)
     else:
         if info[3] == True and ctx.channel.is_nsfw() == False:
             await ctx.send(embed=make_embed(
                 title="Sorry, I can't send this post to a non-NSFW channel",
                 footer=
                 "Try using the command again or make the channel NSFW"))
         else:
             await ctx.send(embed=make_embed(
                 title=info[0],
                 description=info[1],
                 footer=f"Posted on r/{info[2]} by u/{info[4]}"))
Пример #7
0
 async def loopNext(self, ctx):
     ne = self.stat.next_iteration.replace(
         tzinfo=datetime.timezone.utc) - datetime.datetime.now(
             datetime.timezone.utc)
     #print(ne)
     await ctx.send(embed=make_embed(
         title=
         f"{ne.seconds//3600} Hour(s) {int(round((ne.seconds/60)%60, 0))} Minute(s) Until Next Status Loop"
     ))
Пример #8
0
 async def wiki(self, ctx, *, topic=None):
     if not topic:
         topic = wikipedia.random()
     page = wikipedia.page(title=topic)
     await ctx.send(embed=make_embed(
         title=page.title,
         description=wikipedia.summary(title=topic, sentences=2),
         link=page.url,
         footer=
         "Wikipedia is hosted by the Wikimedia Foundation, a non-profit organization that also hosts a range of other projects."
     ))
Пример #9
0
 async def on_command_error(self, ctx, error):
     #if self.eStat:
     eType = type(error)
     #print(eType)
     eFoot = "This is likely the fault of the bots creator. DM him to let him know!"
     eColor = 16711680
     if eType is commands.CommandInvokeError:
         await ctx.send(embed=make_embed(
             title="Command Invoke Error",
             description=f"Details are: `{error.original}`",
             color=eColor,
             footer=eFoot))
     # elif eType is commands.CommandNotFound: #took it out bc it was being annoying as fucc
     #   await ctx.send(embed=make_embed(title="Command Not Found", color=eColor,footer=eFoot))
     elif eType is commands.MissingRequiredArgument:
         await ctx.send(
             embed=make_embed(title=f"Missing argument: `{error.param}`",
                              color=eColor,
                              footer=eFoot))
     elif eType is commands.TooManyArguments:
         await ctx.send(
             embed=make_embed(title=f"You used too many arguments",
                              color=eColor,
                              footer=eFoot))
     elif eType in [commands.UserNotFound, commands.MemberNotFound]:
         await ctx.send(
             embed=make_embed(title=f"`{error.argument}` was not found",
                              color=eColor,
                              footer=eFoot))
     elif eType is commands.MissingPermissions:
         await ctx.send(embed=make_embed(
             title="Must have following permission(s): " +
             ", ".join([f"`{perm}`" for perm in error.missing_perms]),
             color=eColor,
             footer=eFoot))
     elif eType is commands.BotMissingPermissions:
         await ctx.send(embed=make_embed(
             title="I must have following permission(s): " +
             ", ".join([f"`{perm}`" for perm in error.missing_perms]),
             color=eColor,
             footer=eFoot))
     elif eType is commands.NotOwner:
         await ctx.send(embed=make_embed(
             title=f"You aren't bot owner", color=eColor, footer=eFoot))
     else:
         await ctx.send(embed=make_embed(
             title="Something went wrong", color=eColor, footer=eFoot))
Пример #10
0
 async def groupAdd(self, ctx, groupName: str, *, members):
     if "@" in groupName:
         await ctx.send(embed=make_embed(
             title="Missing Argument `groupName`",
             color=16711680,
             footer="Name the group something you'll remember!"))
     else:
         members = stringToList(
             removeChar(members, removes=["<", "!", "@", ">"]))
         #print(members)
         mJson = jsGet("groups")
         if groupName not in mJson:
             mJson[groupName] = members
             with open("groups.json", "w") as j:
                 json.dump(mJson, j, indent=2, sort_keys=True)
             await ctx.send(embed=make_embed(
                 title=f"Group: \"{groupName}\" added",
                 description=
                 f"Members are {listToString([i.mention for i in userGrab(self.client,mJson[groupName])],', ',' and ')}"
             ))
         else:
             await ctx.send(
                 embed=make_embed(title="Group already exists",
                                  footer="Try using another name"))
Пример #11
0
 async def admin(self, ctx, user: discord.Member = None):
     action = None
     with open("admo.json", "r") as j:
         mJson = json.load(j)
     #print(f"before: {mJson}")
     if user and ctx.author.id == me:
         if user.id in mJson["admin"]:
             mJson["admin"].remove(user.id)
             action = f"{userGrab(self.client, users = [user.id])[0].name} removed successfully!"
         else:
             mJson["admin"].append(user.id)
             #print(f"after {mJson}")
             action = f"{userGrab(self.client, users = [user.id])[0].name} added successfully!"
         with open("admo.json", "w") as j:
             json.dump(mJson, j, indent=2, sort_keys=True)
     await ctx.send(embed=make_embed(
         title="Admin List",
         description=
         f'{memlistToString(self.client, mJson["admin"], separator=", ")}',
         footer=action))
Пример #12
0
 async def guilds(self, ctx, idk="0"):
     gList = []
     async for guild in self.client.fetch_guilds(limit=150):
         if (guild.id == int(idk)) and (ctx.author.id
                                        in jsGet("admo")["admin"]):
             await guild.leave()
             gList.append(f"I left `{guild.name}` (id {guild.id})")
         else:
             gList.append(f"`{guild.name}`: {guild.id}")
     gList.sort()
     if idk == "-1":
         sub = f"Your guild list, {ctx.author}"
         body = listToString(gList, separator="\n")
         mailSend(sub, body)
         msg = await ctx.send("Sent!")
         await msg.delete(delay=2.5)
     else:
         await ctx.send(embed=make_embed(title="Servers I'm In",
                                         description=listToString(
                                             gList, separator="\n")))
Пример #13
0
 async def bible(self, ctx):
     b = bible()
     await ctx.send(
         embed=make_embed(title=b[0], description=b[1], author="God"))
Пример #14
0
 async def redditError(self, ctx, sub):
     await ctx.send(embed=make_embed(
         title="Something went wrong",
         description=
         f"Requested subreddit: r/{sub} has too many of the wrong post type for the bot to filter",
         footer="Maybe try again with the opposite command?"))
Пример #15
0
 async def invite(self, ctx):
     await ctx.send(embed=make_embed(
         title="Invite me to your server!",
         link=
         "https://discord.com/api/oauth2/authorize?client_id=702143271144783904&permissions=8&scope=bot"
     ))