mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-20 18:06:08 -05:00
Create cog disabling API (#4043)
* create cog disbale base * Because defaults... * lol * announcer needs to respect this * defaultdict mishap * Allow None as guild - Mostly for interop with with ctx.guild * a whitespace issue * Apparently, I broke this too * Apply suggestions from code review Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com> * This can probably be more optimized later, but since this is a cached value, it's not a large issue * Report tunnel closing * mod too * whitespace issue * Fix Artifact of prior method naming * these 3 places should have the check if i understood it correctly * Announce the closed tunnels * tunnel oversight * Make the player stop at next track * added where draper said to put it * Apply suggestions from code review Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com> Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com> Co-authored-by: Drapersniper <27962761+drapersniper@users.noreply.github.com>
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import asyncio
|
||||
import discord
|
||||
from datetime import datetime
|
||||
from redbot.core.utils.chat_formatting import pagify
|
||||
@@ -175,6 +176,19 @@ class Tunnel(metaclass=TunnelMeta):
|
||||
# Backwards-compatible typo fix (GH-2496)
|
||||
files_from_attatch = files_from_attach
|
||||
|
||||
async def close_because_disabled(self, close_message: str):
|
||||
"""
|
||||
Sends a mesage to both ends of the tunnel that the tunnel is now closed.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
close_message: str
|
||||
The message to send to both ends of the tunnel.
|
||||
"""
|
||||
|
||||
tasks = [destination.send(close_message) for destination in (self.recipient, self.origin)]
|
||||
await asyncio.gather(*tasks, return_exceptions=True)
|
||||
|
||||
async def communicate(
|
||||
self, *, message: discord.Message, topic: str = None, skip_message_content: bool = False
|
||||
):
|
||||
|
||||
Reference in New Issue
Block a user