Пример #1
0
 async def ban(self, ctx, member: discord.Member, *reason):
     if CheckBlacklist(ctx.author.id):
         await ctx.author.send(
             f"You have been banned from using ProtoBot for reason {CheckBlacklist(ctx.author.id)}"
         )
         return
     if CheckDisabled(ctx.guild.id, "ban"):
         await ctx.send(
             "<:error:724683693104562297> | This command has been disabled for this server.",
             delete_after=15)
         return
     BanMsg = await ctx.send(
         f"<a:loading:725022752150519941> | Attempting to ban {member.mention}"
     )
     if reason == ():
         await ctx.guild.ban(member, reason=f"Banned by {ctx.author}")
         await BanMsg.edit(
             content=
             f"`{member}` was banned by {ctx.author.mention} without a reason."
         )
     else:
         reason = " ".join(reason)
         await ctx.guild.ban(member,
                             reason=f"Banned by {ctx.author} for {reason}")
         await BanMsg.edit(
             content=
             f"`{member}` was banned by {ctx.author.mention} for `{reason}`"
         )
Пример #2
0
 async def minimumstars(self, ctx, MinimumStars: int):
     if CheckBlacklist(ctx.author.id):
         await ctx.author.send(
             f"You have been banned from using ProtoBot for reason {CheckBlacklist(ctx.author.id)}"
         )
         return
     if CheckDisabled(ctx.guild.id, "minimumstars"):
         await ctx.send(
             "<:error:724683693104562297> | This command has been disabled for this server.",
             delete_after=15)
         return
     self.SettingsCursor.execute(
         "SELECT ChannelID FROM starboard WHERE GuildID = ?",
         (ctx.guild.id, ))
     ChannelID = self.SettingsCursor.fetchone()
     if ChannelID == None:
         await ctx.send(
             "<:error:724683693104562297> | You must set a starboard channel first."
         )
         return
     self.SettingsCursor.execute(
         "UPDATE starboard SET StarAmount = ? WHERE GuildID = ?",
         (MinimumStars, ctx.guild.id))
     self.SettingsDB.commit()
     await ctx.send(
         f"Minimum stars set. {MinimumStars} stars are required to get on the starboard."
     )
Пример #3
0
 async def unban(self, ctx, ID: int, *reason):
     if CheckBlacklist(ctx.author.id):
         await ctx.author.send(
             f"You have been banned from using ProtoBot for reason {CheckBlacklist(ctx.author.id)}"
         )
         return
     if CheckDisabled(ctx.guild.id, "ban"):
         await ctx.send(
             "<:error:724683693104562297> | This command has been disabled for this server.",
             delete_after=15)
         return
     BanMsg = await ctx.send(
         f"<a:loading:725022752150519941> | Attempting to unban {ID}")
     UnbanTarget = None
     async for entry in ctx.guild.audit_logs(
             action=discord.AuditLogAction.ban):
         if entry.target.id == ID:
             if reason == ():
                 await ctx.guild.unban(
                     entry.target,
                     f"Unbanned by {ctx.author} without a reason.")
             else:
                 reason = " ".join(reason)
                 await ctx.guild.unban(
                     entry.target,
                     f"Unbanned by {ctx.author} for {reason}.")
             UnbanTarget = entry.target
             break
     if UnbanTarget:
         await BanMsg.edit(content=f"User {UnbanTarget} has been unbanned.")
     else:
         await BanMsg.edit(
             content=
             f"<:error:724683693104562297> | {ID} couldn't be unbanned.")
Пример #4
0
 async def dog(self, ctx, *breed: str):
     if CheckBlacklist(ctx.author.id):
         await ctx.author.send(
             f"You have been banned from using ProtoBot for reason {CheckBlacklist(ctx.author.id)}"
         )
         return
     if CheckDisabled(ctx.guild.id, "dog"):
         await ctx.send(
             "<:error:724683693104562297> | This command has been disabled for this server.",
             delete_after=15)
         return
     DogMsg = await ctx.send("Getting your dog...")
     if breed != ():
         breed = breed[0]
         DogReq = requests.get(
             f"https://dog.ceo/api/breed/{breed}/images/random")
         DogJson = DogReq.json()
         if DogJson["status"] == "error":
             await ctx.send(
                 f"<:error:724683693104562297> | There was an error.\nError message:\n{DogJson['message']}"
             )
             return
         await DogMsg.edit(
             content=f"Here is your random {breed}:\n{DogJson['message']}")
     else:
         DogReq = requests.get(f"https://dog.ceo/api/breeds/image/random")
         DogJson = DogReq.json()
         if DogJson["status"] == "error":
             await ctx.send(
                 f"<:error:724683693104562297> | There was an error.\nError message:\n{DogJson['message']}"
             )
             return
         await DogMsg.edit(
             content=f"Here is your random dog:\n{DogJson['message']}")
Пример #5
0
	async def qualities(self, ctx, *Weapon):
		if CheckBlacklist(ctx.author.id):
			await ctx.author.send(f"You have been banned from using ProtoBot for reason {CheckBlacklist(ctx.author.id)}")
			return
		if CheckDisabled(ctx.guild.id, "qualities"):
			await ctx.send("<:error:724683693104562297> | This command has been disabled for this server.", delete_after=15)
			return
		if Weapon == ():
			await ctx.send("<:error:724683693104562297> | You must specify a weapon to get the rarities for.")
			return
		Weapon = " ".join(Weapon)
		x = 0
		while x < len(self.Items):
			if self.Items[x].lower() == Weapon.lower():
				WeaponRarities = []
				for Rarity in self.Rarities[x]:
					WeaponRarities.append(Rarity)
				if len(WeaponRarities) > 1:
					Are = "are"
				else:
					Are = "is"
				RarityStr = ', '.join(WeaponRarities)
				await ctx.send(f"The rarities for the {Weapon} {Are} `{RarityStr}`")
				return
			x += 1
		await ctx.send("<:error:724683693104562297> | This weapon does not exist. Check you have spelt it correctly.")
Пример #6
0
 async def joinrole(self, ctx, RoleID: int):
     if CheckBlacklist(ctx.author.id):
         await ctx.author.send(
             f"You have been banned from using ProtoBot for reason {CheckBlacklist(ctx.author.id)}"
         )
         return
     if CheckDisabled(ctx.guild.id, "joinrole"):
         await ctx.send(
             "<:error:724683693104562297> | This command has been disabled for this server.",
             delete_after=15)
         return
     self.SettingsCursor.execute(
         "SELECT RoleID FROM joinrole WHERE GuildID = ?", (ctx.guild.id, ))
     JoinRole = self.SettingsCursor.fetchone()
     if JoinRole == None:
         self.SettingsCursor.execute(
             "INSERT INTO joinrole(RoleID, GuildID) VALUES(?,?)",
             (RoleID, ctx.guild.id))
     else:
         self.SettingsCursor.execute(
             "UPDATE joinrole SET RoleID = ? WHERE GuildID = ?",
             (RoleID, ctx.guild.id))
     self.SettingsDB.commit()
     await ctx.send(
         f"The joinrole has been set to {Role}. New members will recieve this role."
     )
Пример #7
0
 async def unmute(self, ctx, *member: discord.Member):
     if CheckBlacklist(ctx.author.id):
         await ctx.author.send(
             f"You have been banned from using ProtoBot for reason {CheckBlacklist(ctx.author.id)}"
         )
         return
     if CheckDisabled(ctx.guild.id, "unmute"):
         await ctx.send(
             "<:error:724683693104562297> | This command has been disabled for this server.",
             delete_after=15)
         return
     GuildID = ctx.guild.id
     self.SettingsCursor.execute(
         "SELECT RoleID FROM mutedrole WHERE GuildID = ?", (GuildID, ))
     self.MutedRole = self.SettingsCursor.fetchone()
     if self.MutedRole == None:
         await ctx.send(
             "<:error:724683693104562297> | I cannot unmute people if there is no muted role."
         )
         return
     if member == ():
         await ctx.send(
             "<:error:724683693104562297> | You need to mention who to unmute."
         )
         return
     member = member[0]
     self.MutedRole = int(self.MutedRole[0])
     RoleObj = get(ctx.guild.roles, id=self.MutedRole)
     if RoleObj not in member.roles:
         await ctx.send(
             f"<:error:724683693104562297> | {member.mention} is not muted with my mute role. I cannot unmute them."
         )
         return
     await member.remove_roles(RoleObj)
     await ctx.send(f"Removed the muted role from {member.mention}")
Пример #8
0
 async def prefix(self, ctx, *prefix: str):
     if CheckBlacklist(ctx.author.id):
         await ctx.author.send(
             f"You have been banned from using ProtoBot for reason {CheckBlacklist(ctx.author.id)}"
         )
         return
     GuildID = ctx.guild.id
     if prefix == ():
         self.SettingsCursor.execute(
             "SELECT prefix FROM prefix WHERE GuildID = ?", (GuildID, ))
         self.CurrentPrefix = self.SettingsCursor.fetchone()
         if self.CurrentPrefix == None:
             self.CurrentPrefix = self.Config["Settings"]["Prefix"]
         else:
             self.CurrentPrefix = self.CurrentPrefix[0]
         await ctx.send(
             f"The current prefix is {self.CurrentPrefix} (p+ and mentioning will always work)"
         )
         return
     self.SettingsCursor.execute(
         "SELECT prefix FROM prefix WHERE GuildID = ?", (GuildID, ))
     self.CurrentPrefix = self.SettingsCursor.fetchone()
     if self.CurrentPrefix == None:
         self.SettingsCursor.execute(
             "INSERT INTO prefix(GuildID, prefix) VALUES (?,?)",
             (GuildID, prefix[0]))
     else:
         self.SettingsCursor.execute(
             "UPDATE prefix SET prefix = ? WHERE GuildID = ?",
             (prefix[0], GuildID))
     self.SettingsDB.commit()
     await ctx.send(f"The prefix has been updated to {prefix[0]}")
Пример #9
0
 async def daily(self, ctx):
     if CheckBlacklist(ctx.author.id):
         await ctx.author.send(
             f"You have been banned from using ProtoBot for reason {CheckBlacklist(ctx.author.id)}"
         )
         return
     if CheckDisabled(ctx.guild.id, "daily"):
         await ctx.send(
             "<:error:724683693104562297> | This command has been disabled for this server.",
             delete_after=15)
         return
     self.CurrencyCursor.execute(
         "SELECT ProtoPoints FROM protopoints WHERE UserID = ?",
         (ctx.author.id, ))
     ProtoPoints = self.CurrencyCursor.fetchone()
     if ProtoPoints == None:
         self.CurrencyCursor.execute(
             "INSERT INTO protopoints(UserID, ProtoPoints) VALUES(?,?)",
             (ctx.author.id, 100))
         self.CurrencyDB.commit()
         await ctx.send(
             f"<:protopoints:724613134198767646> | Daily claimed! {ctx.author.mention} now has 100 ProtoPoints."
         )
         return
     ProtoPoints = int(ProtoPoints[0])
     ProtoPoints += 100
     self.CurrencyCursor.execute(
         "UPDATE protopoints SET ProtoPoints = ? WHERE UserID = ?",
         (ProtoPoints, ctx.author.id))
     self.CurrencyDB.commit()
     await ctx.send(
         f"<:protopoints:724613134198767646> | Daily claimed! {ctx.author.mention} now has {ProtoPoints} ProtoPoints."
     )
Пример #10
0
 async def balance(self, ctx, *user: discord.Member):
     if CheckBlacklist(ctx.author.id):
         await ctx.author.send(
             f"You have been banned from using ProtoBot for reason {CheckBlacklist(ctx.author.id)}"
         )
         return
     if CheckDisabled(ctx.guild.id, "balance"):
         await ctx.send(
             "<:error:724683693104562297> | This command has been disabled for this server.",
             delete_after=15)
         return
     if user == ():
         user = ctx.author
     else:
         user = user[0]
     self.CurrencyCursor.execute(
         "SELECT ProtoPoints FROM protopoints WHERE UserID = ?",
         (user.id, ))
     ProtoPoints = self.CurrencyCursor.fetchone()
     if ProtoPoints == None:
         self.CurrencyCursor.execute(
             "INSERT INTO protopoints(UserID, ProtoPoints) VALUES(?,?)",
             (user.id, 0))
         self.CurrencyDB.commit()
         await ctx.send(
             f"<:protopoints:724613134198767646> | {user.mention} has 0 ProtoPoints."
         )
         return
     ProtoPoints = ProtoPoints[0]
     await ctx.send(
         f"<:protopoints:724613134198767646> | {user.mention} has {ProtoPoints} ProtoPoints."
     )
Пример #11
0
 async def starboardchannel(self, ctx,
                            StarboardChannel: discord.TextChannel):
     if CheckBlacklist(ctx.author.id):
         await ctx.author.send(
             f"You have been banned from using ProtoBot for reason {CheckBlacklist(ctx.author.id)}"
         )
         return
     if CheckDisabled(ctx.guild.id, "starboardchannel"):
         await ctx.send(
             "<:error:724683693104562297> | This command has been disabled for this server.",
             delete_after=15)
         return
     self.SettingsCursor.execute(
         "SELECT ChannelID FROM starboard WHERE GuildID = ?",
         (ctx.guild.id, ))
     ChannelID = self.SettingsCursor.fetchone()
     if ChannelID == None:
         self.SettingsCursor.execute(
             "INSERT INTO starboard(GuildID, ChannelID, StarAmount) VALUES(?,?,?)",
             (ctx.guild.id, StarboardChannel.id, 3))
         self.SettingsDB.commit()
         await ctx.send(
             f"Starboard channel set to {StarboardChannel.mention}. 3 stars are required to get on the starboard."
         )
         return
     self.SettingsCursor.execute(
         "UPDATE starboard SET ChannelID = ? WHERE GuildID = ?",
         (StarboardChannel.id, ctx.guild.id))
     self.SettingsDB.commit()
     await ctx.send(
         f"Starboard channel set to {StarboardChannel.mention}. 3 stars are required to get on the starboard."
     )
Пример #12
0
 async def changelog(self, ctx):
     if CheckBlacklist(ctx.author.id):
         await ctx.author.send(
             f"You have been banned from using ProtoBot for reason {CheckBlacklist(ctx.author.id)}"
         )
         return
     if CheckDisabled(ctx.guild.id, "changelog"):
         await ctx.send(
             "<:error:724683693104562297> | This command has been disabled for this server.",
             delete_after=15)
         return
     Log = []
     ChangelogMsg = await ctx.send(
         "<a:loading:725022752150519941> | Opening changelog...")
     with open(f".{os.path.sep}Config{os.path.sep}changelog.txt"
               ) as Changelog:
         Line = Changelog.readline()
         while Line:
             Log.append(Line)
             Line = Changelog.readline()
     self.Config = configparser.ConfigParser()
     self.Config.read(f".{os.path.sep}Config{os.path.sep}config.ini")
     ChangelogEmbed = discord.Embed(
         title="ProtoBot changelog",
         description=f"Current version: {self.Config['Settings']['Version']}"
     )
     while len(Log) > 24:
         del Log[0]
     for Line in Log:
         ChangelogEmbed.add_field(name=f"Version: {Line.split(':')[0]}",
                                  value=f"{Line.split(':')[-1][1:]}")
     await ChangelogMsg.edit(content="", embed=ChangelogEmbed)
Пример #13
0
	async def love(self, ctx, member: discord.Member):
		if CheckBlacklist(ctx.author.id):
			await ctx.author.send(f"You have been banned from using ProtoBot for reason {CheckBlacklist(ctx.author.id)}")
			return
		if CheckDisabled(ctx.guild.id, "love"):
			await ctx.send("<:error:724683693104562297> | This command has been disabled for this server.", delete_after=15)
			return
		"""if member.id == ctx.author.id:
			await ctx.send("<:error:724683693104562297> | You can't love yourself :(")
			return"""
		await ctx.send(f"{ctx.author.mention} loves {member.mention} <3")
Пример #14
0
 async def ball(self, ctx):
     if CheckBlacklist(ctx.author.id):
         await ctx.author.send(
             f"You have been banned from using ProtoBot for reason {CheckBlacklist(ctx.author.id)}"
         )
         return
     if CheckDisabled(ctx.guild.id, "ball"):
         await ctx.send(
             "<:error:724683693104562297> | This command has been disabled for this server.",
             delete_after=15)
         return
     await ctx.send(random.choice(self.BallChoices))
Пример #15
0
	async def refprice(self, ctx, Currency: typing.Optional[str] = "gbp"):
		if CheckBlacklist(ctx.author.id):
			await ctx.author.send(f"You have been banned from using ProtoBot for reason {CheckBlacklist(ctx.author.id)}")
			return
		if CheckDisabled(ctx.guild.id, "refprice"):
			await ctx.send("<:error:724683693104562297> | This command has been disabled for this server.", delete_after=15)
			return
		for Money in self.Currencies:
			if Currency.lower() == Money.lower():
				await ctx.send(f"The price of ref in {Currency.upper()} is {self.RefPrice[Currency.lower()]}")
				return
		await ctx.send(f"<:error:724683693104562297> | {Currency} is not a supported currency.")
Пример #16
0
	async def snuggle(self, ctx, *member: discord.Member):
		if CheckBlacklist(ctx.author.id):
			await ctx.author.send(f"You have been banned from using ProtoBot for reason {CheckBlacklist(ctx.author.id)}")
			return
		if CheckDisabled(ctx.guild.id, "snuggle"):
			await ctx.send("<:error:724683693104562297> | This command has been disabled for this server.", delete_after=15)
			return
		if member == ():
			member = ctx.author
		else:
			member = member[0]
		await ctx.send(f"Snuggles {member.mention} UwU")
Пример #17
0
 async def ping(self, ctx):
     if CheckBlacklist(ctx.author.id):
         await ctx.author.send(
             f"You have been banned from using ProtoBot for reason {CheckBlacklist(ctx.author.id)}"
         )
         return
     if CheckDisabled(ctx.guild.id, "ping"):
         await ctx.send(
             "<:error:724683693104562297> | This command has been disabled for this server.",
             delete_after=15)
         return
     await ctx.send(f"Current ping: {round(self.bot.latency*1000)}ms")
Пример #18
0
 async def coin(self, ctx):
     if CheckBlacklist(ctx.author.id):
         await ctx.author.send(
             f"You have been banned from using ProtoBot for reason {CheckBlacklist(ctx.author.id)}"
         )
         return
     if CheckDisabled(ctx.guild.id, "coin"):
         await ctx.send(
             "<:error:724683693104562297> | This command has been disabled for this server.",
             delete_after=15)
         return
     Options = ["heads", "tails"]
     await ctx.send(f"Its {random.choice(Options)}!")
Пример #19
0
 async def info(self, ctx, *user: discord.Member):
     if CheckBlacklist(ctx.author.id):
         await ctx.author.send(
             f"You have been banned from using ProtoBot for reason {CheckBlacklist(ctx.author.id)}"
         )
         return
     if CheckDisabled(ctx.guild.id, "info"):
         await ctx.send(
             "<:error:724683693104562297> | This command has been disabled for this server.",
             delete_after=15)
         return
     InfoMsg = await ctx.send(
         "<a:loading:725022752150519941> | Getting user info")
     if user == ():
         user = ctx.author
     else:
         user = user[0]
     StatsEmbed = discord.Embed(title=f"{user}'s info",
                                description=f"**User ID:** {user.id}")
     StatsEmbed.set_thumbnail(url=user.avatar_url)
     StatsEmbed.add_field(name="**Server nick**",
                          value=user.nick,
                          inline=False)
     Weekdays = [
         "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday",
         "Sunday"
     ]
     Weekday = Weekdays[int(user.joined_at.strftime("%w"))]
     StatsEmbed.add_field(
         name="**Server join time**",
         value=
         f"{Weekday}, {user.joined_at.strftime('%B %d')}th {user.joined_at.strftime('%Y')} at {user.joined_at.strftime('%H:%M:%S')}",
         inline=False)
     Weekday = Weekdays[int(user.created_at.strftime("%w"))]
     StatsEmbed.add_field(
         name="**User create time**",
         value=
         f"{Weekday}, {user.created_at.strftime('%B %d')}th {user.created_at.strftime('%Y')} at {user.created_at.strftime('%H:%M:%S')}",
         inline=False)
     Roles = []
     for Role in user.roles:
         if "@everyone" not in Role.name:
             Roles.append(Role.name)
     RolesStr = ", ".join(Roles)
     if RolesStr == "":
         RolesStr = "None"
     StatsEmbed.add_field(name=f"**Roles [{len(user.roles) - 1}]**",
                          value=RolesStr)
     StatsEmbed.add_field(name="**Top role**", value=user.top_role)
     await InfoMsg.edit(content="", embed=StatsEmbed)
Пример #20
0
 async def uptime(self, ctx):
     if CheckBlacklist(ctx.author.id):
         await ctx.author.send(
             f"You have been banned from using ProtoBot for reason {CheckBlacklist(ctx.author.id)}"
         )
         return
     if CheckDisabled(ctx.guild.id, "uptime"):
         await ctx.send(
             "<:error:724683693104562297> | This command has been disabled for this server.",
             delete_after=15)
         return
     self.Uptime = format_timespan(time.time() - self.StartTime,
                                   max_units=3)
     await ctx.send(f"ProtoBot has been up for {self.Uptime}")
Пример #21
0
 async def pay(self, ctx, User: discord.Member, Amount: int):
     if CheckBlacklist(ctx.author.id):
         await ctx.author.send(
             f"You have been banned from using ProtoBot for reason {CheckBlacklist(ctx.author.id)}"
         )
         return
     if CheckDisabled(ctx.guild.id, "pay"):
         await ctx.send(
             "<:error:724683693104562297> | This command has been disabled for this server.",
             delete_after=15)
         return
     AuthorID = ctx.author.id
     UserID = User.id
     self.CurrencyCursor.execute(
         "SELECT ProtoPoints FROM protopoints WHERE UserID = ?",
         (AuthorID, ))
     AuthorProtoPoints = self.CurrencyCursor.fetchone()
     self.CurrencyCursor.execute(
         "SELECT ProtoPoints FROM protopoints WHERE UserID = ?", (UserID, ))
     UserProtoPoints = self.CurrencyCursor.fetchone()
     if AuthorProtoPoints == None or int(AuthorProtoPoints[0]) < Amount:
         await ctx.send(
             "You do not have enough ProtoPoints to pay this amount.")
         return
     AuthorProtoPoints = int(AuthorProtoPoints[0])
     NonExistantUser = False
     if UserProtoPoints == None:
         UserProtoPoints = 0
         NonExistantUser = True
     else:
         UserProtoPoints = int(UserProtoPoints[0])
     AuthorProtoPoints -= Amount
     UserProtoPoints += Amount
     self.CurrencyCursor.execute(
         "UPDATE protopoints SET ProtoPoints = ? WHERE UserID = ?",
         (AuthorProtoPoints, AuthorID))
     if NonExistantUser:
         self.CurrencyCursor.execute(
             "INSERT INTO protopoints(UserID, ProtoPoints) VALUES(?,?)",
             (UserID, UserProtoPoints))
     else:
         self.CurrencyCursor.execute(
             "UPDATE protopoints SET ProtoPoints = ? WHERE UserID = ?",
             (UserProtoPoints, UserID))
     self.CurrencyDB.commit()
     await ctx.send(
         f"{ctx.author.mention} ({AuthorProtoPoints} ProtoPoints) has paid {Amount} ProtoPoints to {User.mention} ({UserProtoPoints} ProtoPoints). "
     )
Пример #22
0
 async def pblhelp(self, ctx):
     if CheckBlacklist(ctx.author.id):
         await ctx.author.send(
             f"You have been banned from using ProtoBot for reason {CheckBlacklist(ctx.author.id)}"
         )
         return
     if CheckDisabled(ctx.guild.id, "pblhelp"):
         await ctx.send(
             "<:error:724683693104562297> | This command has been disabled for this server.",
             delete_after=15)
         return
     PBLEmbed = discord.Embed(title="PBL Help")
     PBLEmbed.add_field(
         name="What is PBL?",
         value=
         "PBL is a simple programming language made by JezzaProto#6483 to allow people to run simple code on messages safely.\nIt was made specifically for this bot."
     )
     PBLEmbed.add_field(
         name="How can I remove my PBLs?",
         value=
         "You can remove a PBL by its name. If you run the command `p+pbl remove {name}` you can remove that command if it exists.",
         inline=False)
     PBLEmbed.add_field(
         name="What can I do with PBL?",
         value=
         "If you make a .pbl file and send it with the command `p+pbl add {name}` you can add a pbl script to your scripts."
     )
     PBLEmbed.add_field(
         name="How can I run my code?",
         value=
         "You can run your PBL file by using `p+pbl run {name} {message}` and the PBL file will run on the message. You must have added your script to the bot for this to work."
     )
     PBLEmbed.add_field(
         name="How do I make a .pbl file?",
         value=
         "It's very simple. All you have to do is create a file with the .pbl extension, then in a text editor, add operands and opcodes that PBL recognises."
     )
     PBLEmbed.add_field(
         name="RPL Opcode",
         value=
         "RPL (Replace) is used along with 2 operands. Ut replaces the first operand with the second.",
         inline=False)
     PBLEmbed.add_field(
         name="DEL Opcode",
         value=
         "DEL (Delete) is used along with 1 operand. It removes all occurances of this operand in the message."
     )
     await ctx.send("", embed=PBLEmbed)
Пример #23
0
 async def duck(self, ctx):
     if CheckBlacklist(ctx.author.id):
         await ctx.author.send(
             f"You have been banned from using ProtoBot for reason {CheckBlacklist(ctx.author.id)}"
         )
         return
     if CheckDisabled(ctx.guild.id, "duck"):
         await ctx.send(
             "<:error:724683693104562297> | This command has been disabled for this server.",
             delete_after=15)
         return
     DuckMsg = await ctx.send("Getting your random duck...")
     DuckReq = requests.get("https://random-d.uk/api/v2/quack")
     DuckReq = DuckReq.json()
     URL = DuckReq["url"]
     await DuckMsg.edit(content=f"Here is your random duck photo:\n{URL}")
Пример #24
0
 async def avatar(self, ctx, *User: discord.Member):
     if CheckBlacklist(ctx.author.id):
         await ctx.author.send(
             f"You have been banned from using ProtoBot for reason {CheckBlacklist(ctx.author.id)}"
         )
         return
     if CheckDisabled(ctx.guild.id, "avatar"):
         await ctx.send(
             "<:error:724683693104562297> | This command has been disabled for this server.",
             delete_after=15)
         return
     if User == ():
         User = ctx.author
     else:
         User = User[0]
     await ctx.send(f"{User.mention}'s avatar: {User.avatar_url}")
Пример #25
0
 async def purge(self, ctx, amount: int):
     if CheckBlacklist(ctx.author.id):
         await ctx.author.send(
             f"You have been banned from using ProtoBot for reason {CheckBlacklist(ctx.author.id)}"
         )
         return
     if CheckDisabled(ctx.guild.id, "purge"):
         await ctx.send(
             "<:error:724683693104562297> | This command has been disabled for this server.",
             delete_after=15)
         return
     if amount > 100:
         await ctx.send(
             "<:error:724683693104562297> | That is too many messages.")
         return
     await ctx.channel.purge(limit=amount)
     await ctx.send(f"{amount} messages cleared.", delete_after=15)
Пример #26
0
 async def botinfo(self, ctx):
     if CheckBlacklist(ctx.author.id):
         await ctx.author.send(
             f"You have been banned from using ProtoBot for reason {CheckBlacklist(ctx.author.id)}"
         )
         return
     if CheckDisabled(ctx.guild.id, "botinfo"):
         await ctx.send(
             "<:error:724683693104562297> | This command has been disabled for this server.",
             delete_after=15)
         return
     InfoMsg = await ctx.send(
         "<a:loading:725022752150519941> | Getting bot info")
     BotEmbed = discord.Embed(title="ProtoBot information",
                              description="Help command: p+help")
     BotEmbed.set_thumbnail(url=self.bot.user.avatar_url)
     BotEmbed.add_field(
         name="Python information:",
         value=
         f"```OS: {sys.platform}\nPython version: {sys.version}\nDiscord.py version: {discord.__version__}\nPsutil version: {psutil.__version__}```",
         inline=False)
     self.Uptime = format_timespan(time.time() - self.StartTime,
                                   max_units=3)
     BotEmbed.add_field(
         name="Bot information:",
         value=
         f">>> Uptime: {self.Uptime}\nServers: {len(self.bot.guilds)}\nUsers: {len(self.bot.users)}\nPing: {round(self.bot.latency*1000)}ms"
     )
     NetSend = psutil.net_io_counters().bytes_sent
     Units = ["bytes", "KB", "MB", "GB", "TB"]
     SendUnit = 0
     while NetSend > 1024:
         NetSend = NetSend / 1024
         SendUnit += 1
     NetRecv = psutil.net_io_counters().bytes_recv
     RecvUnit = 0
     while NetRecv > 1024:
         NetRecv = NetRecv / 1024
         RecvUnit += 1
     BotEmbed.add_field(
         name="Process information:",
         value=
         f">>> CPU Usage: {psutil.cpu_percent()}%\nRAM Usage: {psutil.virtual_memory().percent}%\nNetwork send: {round(NetSend, 2)}{Units[SendUnit]}\nNetwork recv: {round(NetRecv, 2)}{Units[RecvUnit]}"
     )
     await InfoMsg.edit(content="", embed=BotEmbed)
Пример #27
0
 async def report(self, ctx, *member: discord.Member):
     if CheckBlacklist(ctx.author.id):
         await ctx.author.send(
             f"You have been banned from using ProtoBot for reason {CheckBlacklist(ctx.author.id)}"
         )
         return
     if CheckDisabled(ctx.guild.id, "report"):
         await ctx.send(
             "<:error:724683693104562297> | This command has been disabled for this server.",
             delete_after=15)
         return
     if member == ():
         member = ctx.author
     else:
         member = member[0]
     await ctx.send(
         f"{member.mention} has been reported to the appropriate authorities."
     )
Пример #28
0
 async def cat(self, ctx):
     if CheckBlacklist(ctx.author.id):
         await ctx.author.send(
             f"You have been banned from using ProtoBot for reason {CheckBlacklist(ctx.author.id)}"
         )
         return
     if CheckDisabled(ctx.guild.id, "cat"):
         await ctx.send(
             "<:error:724683693104562297> | This command has been disabled for this server.",
             delete_after=15)
         return
     CatMsg = await ctx.send("Getting your random cat...")
     CatHeader = {"x-api-header": "6ef3130a-1a12-4c82-aff2-95a3c3f7420a"}
     CatReq = requests.get("https://api.thecatapi.com/v1/images/search",
                           headers=CatHeader)
     CatReq = CatReq.json()
     URL = CatReq[0]["url"]
     await CatMsg.edit(content=f"Here is your random cat:\n{URL}")
Пример #29
0
 async def disable(self, ctx, CommandName: str):
     if CheckBlacklist(ctx.author.id):
         await ctx.author.send(
             f"You have been banned from using ProtoBot for reason {CheckBlacklist(ctx.author.id)}"
         )
         return
     if CommandName.lower() in self.IgnoreDisable:
         await ctx.send(
             f"<:error:724683693104562297> | You are not allowed to disable {CommandName.capitalize()}."
         )
         return
     if self.bot.get_command(CommandName.lower()) == None:
         await ctx.send(
             f"<:error:724683693104562297> | {CommandName.capitalize()} is not a command."
         )
         return
     self.SettingsCursor.execute(
         "SELECT Disabled FROM disabledcommands WHERE GuildID = ?",
         (ctx.guild.id, ))
     Disabled = self.SettingsCursor.fetchone()
     OrigDisabled = Disabled
     if Disabled == None or Disabled[0] == "":
         Disabled = [CommandName.lower()]
     else:
         Disabled = Disabled[0].split(",")
         for Command in Disabled:
             if Command.lower() == CommandName.lower():
                 await ctx.send(
                     f"<:error:724683693104562297> | {CommandName.capitalize()} is already disabled."
                 )
                 return
         Disabled.append(CommandName.lower())
     Disabled = ",".join(Disabled)
     if OrigDisabled == None:
         self.SettingsCursor.execute(
             "INSERT INTO disabledcommands(GuildID, Disabled) VALUES(?,?)",
             (ctx.guild.id, Disabled))
     else:
         self.SettingsCursor.execute(
             "UPDATE disabledcommands SET Disabled = ? Where GuildID = ?",
             (Disabled, ctx.guild.id))
     self.SettingsDB.commit()
     await ctx.send(f"{CommandName.capitalize()} is now disabled.")
Пример #30
0
 async def cool(self, ctx, *member: discord.Member):
     if CheckBlacklist(ctx.author.id):
         await ctx.author.send(
             f"You have been banned from using ProtoBot for reason {CheckBlacklist(ctx.author.id)}"
         )
         return
     if CheckDisabled(ctx.guild.id, "cool"):
         await ctx.send(
             "<:error:724683693104562297> | This command has been disabled for this server.",
             delete_after=15)
         return
     if member == ():
         member = ctx.author
     else:
         member = member[0]
     if random.randint(0, 1) == 0:
         await ctx.send(f"{member.mention} is cool :sunglasses:")
     else:
         await ctx.send(f"{member.mention} isn't cool :(")