Skip to content
This repository was archived by the owner on May 25, 2021. It is now read-only.

Commit 877a9d8

Browse files
author
dragdev
committed
Update channels and add a few notes
1 parent 8d04ce2 commit 877a9d8

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

riftgun/cog.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class RiftGun(commands.Cog):
4747
def __init__(self, bot: commands.Bot):
4848
self.bot = bot
4949
if not os.path.exists("./.riftgun"):
50-
print("")
50+
print("Configuration folder does not exist. Creating...")
5151
os.mkdir("./.riftgun")
5252
try:
5353
with open("./.riftgun/rifts.min.json") as rfile:
@@ -82,8 +82,7 @@ async def queue_sender(self):
8282

8383
def cog_unload(self):
8484
self.worker.cancel()
85-
with open("./.riftgun/rifts.min.json", "w+") as wfile:
86-
json.dump(self.data, wfile)
85+
self.save()
8786
print("Saved data and unloaded module")
8887

8988
def save(self):
@@ -113,6 +112,7 @@ async def open_rifts(self, ctx: commands.Context):
113112

114113
to_tabulate = []
115114
for _, info in self.data.items():
115+
# note to all editors: what the hell is this?
116116
master = int(info["source"])
117117
sub = int(info["target"])
118118

@@ -168,6 +168,7 @@ async def close_rift(self, ctx: commands.Context, notify: Optional[bool]=True, *
168168
169169
This command takes the same arguments as [p]openrift.
170170
If the bot can no longer see the rift channel, you can provide the ID instead and it will still be deleted"""
171+
# TODO: need to make it so you can provide either source or target channel.
171172
if not isinstance(target, int):
172173
target: discord.TextChannel
173174
if notify and target.permissions_for(target.guild.me).send_messages:
@@ -223,14 +224,15 @@ async def channel_info(self, ctx: commands.Context, *, channel: GlobalTextChanne
223224
This should be used to make sure you got the right channel before opening."""
224225
channel: discord.TextChannel
225226
nsfw = channel.is_nsfw()
227+
news = channel.is_news()
226228
ago = channel.created_at.strftime("%c") + " " + humanize.naturaltime(channel.created_at)
227229
perms = channel.permissions_for(channel.guild.me).value
228230
e = discord.Embed(
229231
title=f"Name: {channel.name}",
230232
description="ID: `{0.id}`\nGuild: {0.guild.name} (`{0.guild.id}`)\nCategory: {0.category}\n"
231-
"Slowmode: {0.slowmode_delay}\nNSFW: {1}\nCreated at: {2}\n"
233+
"Slowmode: {0.slowmode_delay}\nNSFW: {1}\nAnnouncement: {5}Created at: {2}\n"
232234
"[Permissions Value]({3}): {4}".format(
233-
channel, nsfw, ago, f"https://discordapi.com/permissions.html#{perms}", str(perms)),
235+
channel, nsfw, ago, f"https://discordapi.com/permissions.html#{perms}", str(perms), news),
234236
color=channel.guild.owner.color,
235237
timestamp=channel.created_at
236238
)

0 commit comments

Comments
 (0)