Пример #1
0
 async def set(self, ctx, user: discord.Member = None, amount: int = None):
     GID = str(ctx.guild.id)
     if ctx.author is ctx.guild.owner or ctx.author.id in self.config.owner:
         if GID in self.db["Economy"]:
             if user and amount:
                 done = self.set_money(GID, user.id, amount)
                 if done:
                     await ctx.send(embed=lib.Editable(
                         self, "Some kind of wizardry",
                         f"Set {user.mention}'s balance to {amount} credits.",
                         "Devo Bank"))
                     self.db.sync()
                 else:
                     await ctx.send(embed=lib.Editable(
                         self, "Uh oh", f"{user.name} has no bank account.",
                         "Devo Bank"))
             else:
                 await ctx.send(embed=lib.Editable(
                     self, "Oops", "Please specify a user and an amount.",
                     "Devo Bank"))
         else:
             await ctx.send(embed=lib.Editable(
                 self, "Uh oh",
                 f"The bank is not setup on this server! Type {ctx.prefix}bank register to start.",
                 "Devo Bank"))
     else:
         p = await ctx.send(embed=lib.NoPerm(self))
         await lib.eraset(self, ctx, p)
Пример #2
0
 async def cog(self, ctx):
     if ctx.author.id in self.config.owner:
         usage = await ctx.send(embed=lib.Editable(
             self, "Cog Commands",
             "**load** - loads named cog.\n **unload** - Unloads named cog.\n **names** - Lists all cogs.",
             "Cogs"))
         await lib.erase(ctx, 20, usage)
     else:
         noperm = await ctx.send(embed=lib.NoPerm(self))
         await lib.eraset(self, ctx, noperm)
Пример #3
0
 async def shutdown(self, ctx):
     if ctx.author.id in self.config.owner:
         o = await ctx.send(embed=lib.Editable(
             self, "Going Offline",
             "Self Destruct Sequence Initiation detected.. Shutting down!.",
             "Owner"))
         await self.bot.logout()
     else:
         noperm = await ctx.send(embed=lib.NoPerm(self))
         await lib.eraset(self, ctx, noperm)
Пример #4
0
 async def restart(self, ctx):
     if ctx.author.id in self.config.owner:
         await ctx.send("Restarting...")
         os.system("cls")
         print(f"{self.bot.user.name} is Restarting")
         os.system("py -3 ./bot.py")
         await self.bot.logout()
     else:
         noperm = await ctx.send(embed=lib.NoPerm(self))
         await lib.eraset(self, ctx, noperm)
Пример #5
0
 async def economyset(self, ctx):
     user = ctx.author
     if user.id in self.config.owner:
         msg = "```"
         for k, v in self.settings.items():
             msg += str(k) + ": " + str(v) + "\n"
         msg += "\nType {}help to see the list of commands.```".format(
             ctx.prefix)
         await ctx.send(msg)
     else:
         p = await ctx.send(embed=lib.NoPerm(self))
         await lib.eraset(self, ctx, p)
Пример #6
0
 async def leaveid(self, ctx, id: int = None):
     if ctx.author.id in self.config.owner:
         if id:
             guild = self.bot.get_guild(id)
             await ctx.send(embed=lib.Editable(
                 self, "Success", f"I left the server **{guild}**", "Owner")
                            )
             await guild.leave()
         else:
             e = await ctx.send(embed=lib.Editable(
                 self, "Error", "Please enter a serverid for me to leave",
                 "Error"))
             await lib.eraset(self, ctx, e)
     else:
         noperm = await ctx.send(embed=lib.NoPerm(self))
         await lib.eraset(self, ctx, noperm)
Пример #7
0
    async def prefix(self, ctx, prefix: str = None):
        if ctx.author.id in self.config.owner:
            if prefix:
                self.config["prefix"] = prefix
                with open("./utils/cfg.json", "w") as f:
                    json.dump(self.config, f)
                await ctx.send(
                    f"Your prefix has been set to {ctx.prefix}\n\nYour bot will need a full restart for this to apply :frowning:. Using {ctx.prefix}restart will not work."
                )
            else:
                await ctx.send(embed=lib.Editable(
                    self, "Uh oh", "You need to give me a prefix to use",
                    "Prefix"))

        else:
            p = await ctx.send(embed=lib.NoPerm(self))
            await lib.eraset(self, ctx, p)
Пример #8
0
 async def pmid(self, ctx, id=None, *args):
     if ctx.author.id in self.config.owner:
         if id:
             member = ctx.author
             userid = ctx.author.id
             avatar = ctx.author.avatar_url
             message = ""
             for word in args:
                 message += word
                 message += " "
             if message is "":
                 e1 = await ctx.send(embed=lib.Editable(
                     self, "Oops!",
                     f"You forgot something!\n\n{ctx.prefix}pmid userid message\n\n This will send a dm to the user with that ID.",
                     "PMID Usage"))
                 await lib.eraset(self, ctx, e1)
             else:
                 try:
                     await ctx.message.delete()
                     user = await self.bot.fetch_user(id)
                     embed = discord.Embed(
                         title=f"You've recieved a message from {member}",
                         colour=0x9bf442,
                     )
                     embed.set_author(name=f"Message from {member}",
                                      icon_url=f"{avatar}")
                     embed.add_field(name="Message:",
                                     value=message,
                                     inline=True)
                     embed.set_footer(text=f"UserID: {userid}")
                     await user.send(embed=embed)
                 except Exception as error:
                     er = await ctx.send(
                         f"I couldnt send your message to {member} because of the error: {error}"
                     )
                     await lib.eraset(self, ctx, er)
         else:
             e = await ctx.send(embed=lib.Editable(
                 self, "Oops!",
                 f"You forgot something!\n\n{ctx.prefix}pmid userid message\n\n This will send a dm to the user with that ID",
                 "PMID Usage"))
             await lib.eraset(self, ctx, e)
     else:
         noperm = await ctx.send(embed=lib.NoPerm(self))
         await lib.eraset(self, ctx, noperm)
Пример #9
0
 async def sstop(self, ctx):
     if ctx.author.guild_permissions.manage_roles:
         author = ctx.author
         if ctx.voice_client is None:
             e = await ctx.send(embed=lib.Editable(
                 self, "Error", "Im not in a voice channel!", "Music"))
             await lib.eraset(self, ctx, e)
         else:
             if author.voice is None:
                 e1 = await ctx.send(embed=lib.Editable(
                     self, "Error", "You arent in a voice channel!",
                     "Music"))
                 await lib.eraset(self, ctx, e1)
             else:
                 await ctx.voice_client.disconnect()
                 await asyncio.sleep(5)
                 await ctx.message.delete()
     else:
         await ctx.send(embed=lib.NoPerm(self))
Пример #10
0
 async def setpresence(self, ctx, activity: str = None, *args):
     if ctx.author.id in self.config.owner:
         listening = discord.ActivityType.listening
         watching = discord.ActivityType.watching
         game = ""
         for gamename in args:
             game += gamename
             game += " "
         if game == "":
             e = await ctx.send(embed=lib.Editable(
                 self, "Error",
                 "Please enter one of these activities with the name you would like after it!\n\n**playing {name}**\n**listening {name}**\n**watching {name}**",
                 "Usage"))
             await lib.eraset(self, ctx, e)
         else:
             if activity == "playing":
                 await lib.sp(self, ctx, game)
                 p = await ctx.send(embed=lib.Editable(
                     self, "Activity Presence",
                     f"The bots status has been set to **Playing** {game} ",
                     "Owner"))
                 await lib.eraset(self, ctx, p)
             if activity == "listening":
                 await lib.sa(self, ctx, listening, game)
                 l = await ctx.send(embed=lib.Editable(
                     self, "Activity Presence",
                     f"The bots status has been set to **Listening to** {game}",
                     "Owner"))
                 await lib.eraset(self, ctx, l)
             if activity == "watching":
                 await lib.sa(self, ctx, watching, game)
                 w = await ctx.send(embed=lib.Editable(
                     self, "Activity Presence",
                     f"The bots status has been set to **Watching** {game}",
                     "Owner"))
                 await lib.eraset(self, ctx, w)
     else:
         noperm = await ctx.send(embed=lib.NoPerm(self))
         await lib.eraset(self, ctx, noperm)
Пример #11
0
 async def pm(self, ctx, user: discord.User = None, *args):
     if ctx.author.id in self.config.owner:
         member = ctx.author
         userid = ctx.author.id
         avatar = ctx.author.avatar_url
         if user:
             message = ""
             for word in args:
                 message += word
                 message += " "
             if message is "":
                 await ctx.send(embed=lib.Editable(
                     self, "Oops!",
                     f"You forgot something!\n\n{ctx.prefix}pm @user message\n\n This will send a dm to the mentioned user.",
                     "PM Usage"))
             else:
                 embed = discord.Embed(
                     title=f"You've recieved a message from {member}",
                     colour=0x9bf442,
                 )
                 embed.set_author(name=f"Message from {member}",
                                  icon_url=f"{avatar}")
                 embed.add_field(name="Message:",
                                 value=message,
                                 inline=True)
                 embed.set_footer(text=f"UserID: {userid}")
                 await user.send(embed=embed)
                 await ctx.message.delete()
         else:
             e = await ctx.send(embed=lib.Editable(
                 self, "Oops!",
                 f"You forgot something!\n\n{ctx.prefix}pm @user message\n\n This will send a dm to the mentioned user.",
                 "PM Usage"))
             await lib.eraset(self, ctx, e)
     else:
         noperm = await ctx.send(embed=lib.NoPerm(self))
         await lib.eraset(self, ctx, noperm)
Пример #12
0
 async def leave(self, ctx):
     if ctx.author == ctx.guild.owner:
         await ctx.guild.leave()
     else:
         noperm = await ctx.send(embed=lib.NoPerm(self))
         await lib.eraset(self, ctx, noperm)