diff --git a/cogs/BotLog.py b/cogs/BotLog.py index 3863752..0e6fbd1 100644 --- a/cogs/BotLog.py +++ b/cogs/BotLog.py @@ -9,8 +9,6 @@ webhook_url = response_json['botlog_webhook_url'] del response_json -outages = {} - class BotLog: def __init__(self, bot): self.bot = bot @@ -20,31 +18,6 @@ async def on_shard_ready(self, shard_id): webhook = discord.Webhook.from_url(webhook_url, adapter = discord.AsyncWebhookAdapter(session)) await webhook.send(content = ':ballot_box_with_check: **Shard #' + str(shard_id) + ' ready.**') - async def on_ready(self): - while True: - high_latency = [] - for i in [(i[0], round(i[1] * 1000)) for i in self.bot.latencies]: - if i[1] > 1000: - outages[i[0]] = 0 - high_latency.append(':no_entry: **Shard #' + str(i[0]) + ' | ' + str(i[1]) + 'ms**') - elif i[1] > 500: - outages[i[0]] = 0 - high_latency.append(':warning: **Shard #' + str(i[0]) + ' | ' + str(i[1]) + 'ms**') - elif i[0] in outages.keys(): - outages[i[0]] = outages[i[0]] + 1 - if outages[i[0]] == 3: - high_latency.append('**Shard #' + str(i[0]) + ' | ' + str(i[1]) + 'ms |** Check: ' + str(outages[i[0]]) + '/3 (successfully recovered)') - del outages[i[0]] - else: - high_latency.append('**Shard #' + str(i[0]) + ' | ' + str(i[1]) + 'ms |** Check: ' + str(outages[i[0]]) + '/3') - - if len(high_latency) > 0: - async with aiohttp.ClientSession() as session: - webhook = discord.Webhook.from_url(webhook_url, adapter = discord.AsyncWebhookAdapter(session)) - await webhook.send(content = '\n'.join(high_latency)) - - await asyncio.sleep(90) - async def on_guild_join(self, guild): bots = [member for member in guild.members if member.bot] async with aiohttp.ClientSession() as session: diff --git a/cogs/Main.py b/cogs/Main.py index c2e0d35..5978251 100644 --- a/cogs/Main.py +++ b/cogs/Main.py @@ -100,6 +100,7 @@ async def on_raw_reaction_add(self, payload): await channel.send(embed = quote_embed(channel, message, user)) @commands.command(aliases = ['q']) + @commands.cooldown(1, 3, type = commands.BucketType.channel) async def quote(self, ctx, msg_id: int = None, *, reply = None): if not msg_id: return await ctx.send(content = error_string + ' **Please specify a message ID to quote.**') @@ -111,18 +112,17 @@ async def quote(self, ctx, msg_id: int = None, *, reply = None): try: message = await ctx.channel.get_message(msg_id) except: - async with ctx.typing(): - for channel in ctx.guild.text_channels: - perms = ctx.guild.me.permissions_in(channel) - if channel == ctx.channel or not perms.read_messages or not perms.read_message_history: - continue - - try: - message = await channel.get_message(msg_id) - except: - continue - else: - break + for channel in ctx.guild.text_channels: + perms = ctx.guild.me.permissions_in(channel) + if channel == ctx.channel or not perms.read_messages or not perms.read_message_history: + continue + + try: + message = await channel.get_message(msg_id) + except: + continue + else: + break if message: if not message.content and message.embeds and message.author.bot: @@ -134,24 +134,6 @@ async def quote(self, ctx, msg_id: int = None, *, reply = None): else: await ctx.send(content = error_string + ' **Could not find the specified message.**') - @commands.command(aliases = ['qp']) - async def quotepart(self, ctx, part_msg, *, reply = None): - if ctx.guild and ctx.guild.id in del_commands and ctx.guild.me.permissions_in(ctx.channel).manage_messages: - await ctx.message.delete() - - message = None - async with ctx.typing(): - async for msg in ctx.channel.history(limit = 1000, before = ctx.message): - if part_msg in msg.content: - message = msg - break - - if message: - message.content = part_msg - await ctx.send(embed = quote_embed(ctx.channel, message, ctx.author)) - else: - await ctx.send(content = error_string + ' **Could not find the specified message.**') - @commands.command() async def prefix(self, ctx, *, prefix = None): if not ctx.guild: diff --git a/cogs/MessageURL.py b/cogs/MessageURL.py index 6a03c19..25165a1 100644 --- a/cogs/MessageURL.py +++ b/cogs/MessageURL.py @@ -36,6 +36,8 @@ async def on_message(self, message): word = i.lower().strip('<>') if word.startswith('https://canary.discordapp.com/channels/'): word = word.strip('https://canary.discordapp.com/channels/') + elif word.startswith('https://ptb.discordapp.com/channels/'): + word = word.strip('https://ptb.discordapp.com/channels/') elif word.startswith('https://discordapp.com/channels/'): word = word.strip('https://discordapp.com/channels/') else: diff --git a/cogs/Pin.py b/cogs/Pin.py index a5739bf..0aea938 100644 --- a/cogs/Pin.py +++ b/cogs/Pin.py @@ -70,27 +70,6 @@ async def on_raw_reaction_add(self, payload): await channel.send(content = '📌 **Message ID:** ' + str(payload.message_id) + ' | ' + pin_channel.mention, embed = pin_embed(message)) - async def on_raw_message_edit(self, payload): - if int(payload.data['guild_id']) in pin_channels.keys() and int(payload.data['channel_id']) != pin_channels[int(payload.data['guild_id'])]: - async for msg in self.bot.get_channel(pin_channels[int(payload.data['guild_id'])]).history(limit = 50): - if str(payload.message_id) in msg.content: - message = msg - break - - if message: - source_message = await self.bot.get_channel(int(payload.data['channel_id'])).get_message(payload.message_id) - - try: - await message.edit(embed = pin_embed(source_message)) - except UnboundLocalError: - pass - - async def on_raw_message_delete(self, payload): - if payload.guild_id in pin_channels.keys(): - async for msg in self.bot.get_channel(pin_channels[payload.guild_id]).history(limit = 50): - if str(payload.message_id) in msg.content: - return await msg.delete() - @commands.command(aliases = ['pinc']) async def pinchannel(self, ctx, channel: discord.TextChannel = None): if not ctx.guild or not ctx.author.guild_permissions.manage_guild: diff --git a/docs/index.md b/docs/index.md index ec03637..e4f10c3 100644 --- a/docs/index.md +++ b/docs/index.md @@ -12,25 +12,25 @@ Quote is a Discord bot that allows users to easily quote messages, a feature tha ## Quoting -* You can quote messages by reacting with 💬 (`:speech_balloon:`) to them (this feature needs to be enable first by using the `>reactions` command). +* You can quote messages by reacting with 💬 (`:speech_balloon:`) to them (this feature needs to be enabled first by using the `>reactions` command). * You can quote messages from any channel by using the `>quote` command, like this: `>quote 507103646995972096 My Optional Reply`, where the number is the ID of the message you want to quote. - * To get message IDs you need to enable Developer Mode in Discord >settings >Appearance >Developer Mode, and right click on a message >Copy ID. + * To get message IDs you need to enable Developer Mode in your `User Settings` -> `Appearance` > `Developer Mode`, and right click on a message then `Copy ID`. * ![Developer Mode](https://cdn.discordapp.com/attachments/154295458531901441/526118407071072281/unknown.png) * ![Copy ID](https://cdn.discordapp.com/attachments/154295458531901441/526118743550722049/unknown.png) -* You can now quote by directly sending a link to a message, Quote will automatically embed the linked message. +* You can now quote by directly sending a link to a message. Quote will automatically embed the linked message. - * To obtain the link to a message enable Developer Mode as described above and click on the three dots to the right of a message, there will be a Copy Link option. + * To obtain the link to a message enable `Developer Mode`, as described above, and click on the three dots to the right of a message, there will be a `Copy Link` option. * ![Copy Link](https://cdn.discordapp.com/attachments/154295458531901441/526117532248047626/unknown.png) * The footer contains useful information on the requester, channel of the original message and timestamp of the original message. -* The Original Poster name in the quote is actually a clickable link to the original message. +* The `Original Poster` name in the quote is actually a clickable link to the original message. * The bot supports quoting of regular messages sent either by users or other bots, but also supports quoting messages containing single or multiple files attachments. * If the original message has a single image as an attachment Quote will automatically embed it. @@ -42,28 +42,30 @@ Quote is a Discord bot that allows users to easily quote messages, a feature tha ## Pinning -* You can define a pin channel by running the command `>pinchannel #myChannel`, and have the bot embed there any message to which you add a 📌 (`:pushpin:`) reaction to. (Only users with Manage Messages permission can use this to avoid spam.) +* You can define a pin channel by running the command `>pinchannel #myChannel`, and have the bot embed any message on which you add a 📌 (`:pushpin:`) reaction to. (Only users with `Manage Messages` permission can use this to avoid spam.) ## Snipe -* Never seen an unread message notification in a channel to then find nothing there? Quote will allow users with Manage Messages permission to check the last deleted message in a channel. - * Use the command `>snipe` to show last deleted message in the current channel. - * Add a channel identifier `>snipe #myChannel` to see last deleted message in #myChannel. +* Ever seen an unread message notification in a channel, but only to find nothing? Quote will allow users with `Manage Messages` permission to check the last deleted message in a channel. +* Use the command `>snipe` to show last deleted message in the current channel. +* Add a channel identifier `>snipe #myChannel` to see last deleted message in #myChannel. ## Custom Prefix -* Don't like `>` as your server's prefix? You can change it by using `>prefix ` eg: `>prefix !`. +* Don't like `>` as your server's prefix? You can change it by running the command `>prefix ` eg: `>prefix !`. ## Help * The bot comes with a `>help` function that shows the list of all available commands. -* You can type `>help ` to see more information about each command. +* You can type `>help ` to see more information about that command. + + ## Anti-Bot Farm -* Quote will leave any server with more than 20 members that has more than 70% of the population composed of Bots. +* Quote will leave any server that has 20+ members, of which 70% are bots. @@ -77,9 +79,11 @@ Quote is a Discord bot that allows users to easily quote messages, a feature tha ## New Features -* Interested in what the new features are/will be? Head over to our [**Trello**](https://trello.com/b/Cuazpsh8/quote-bot) under `In Progress`, `Needs Testing` and `Planned` lists. +* Interested in what the new features are/will be? + +Head over to our [**Trello**](https://trello.com/b/Cuazpsh8/quote-bot) under the Board `In Progress`, `Needs Testing` and `Planned` lists. ## Suggestions -* Have a suggestion? Join our [**Support Server**](https://discord.gg/sbySHxA) and head over to #suggestions. Follow the template to submit your own suggestion. +* Have a suggestion? Join our [**Support Server**](https://discord.gg/sbySHxA) and head over to `#suggestions`, where you can find a template on how to suggest new features/request changes of old features. diff --git a/launcher_linux.sh b/launcher_linux.sh index 81440dc..4703290 100644 --- a/launcher_linux.sh +++ b/launcher_linux.sh @@ -16,7 +16,7 @@ if [ "$choice" = "1" ] ; then echo "" echo "Checking requirements.." sleep 5s - curl https://raw.githubusercontent.com/kyo-rh/QuoteRequirements/master/reqs.sh | sh + curl https://raw.githubusercontent.com/vfx-looks-of-cute-things/QuoteRequirements/master/reqs.sh | sh echo "" echo "Done!" echo "Starting the bot.." @@ -24,7 +24,7 @@ if [ "$choice" = "1" ] ; then python3 quote.py else if [ "$choice" = "2" ] ; then - curl https://raw.githubusercontent.com/kyo-rh/QuoteRequirements/master/reqs.sh | sh + curl https://raw.githubusercontent.com/vfx-looks-of-cute-things/QuoteRequirements/master/reqs.sh | sh echo "Starting the bot with auto restart.." sh autorestart_linux.sh exit 1