[infochannel] this should work (#54)

* this works 100%

But I also removed making the category, so do check it first because other than the channel count and category, I didn't really change anything else?

* hi
pull/60/head
Ellie 6 years ago committed by bobloy
parent 1924eab355
commit 871c737a60

@ -4,6 +4,7 @@ from redbot.core import Config, checks, commands
from redbot.core.bot import Red from redbot.core.bot import Red
from typing import Any from typing import Any
import asyncio
Cog: Any = getattr(commands, "Cog", object) Cog: Any = getattr(commands, "Cog", object)
@ -36,6 +37,7 @@ class ForceMention(Cog):
if not role_obj.mentionable: if not role_obj.mentionable:
await role_obj.edit(mentionable=True) await role_obj.edit(mentionable=True)
await ctx.send("{}\n{}".format(role_obj.mention, message)) await ctx.send("{}\n{}".format(role_obj.mention, message))
await asyncio.sleep(5)
await role_obj.edit(mentionable=False) await role_obj.edit(mentionable=False)
else: else:
await ctx.send("{}\n{}".format(role_obj.mention, message)) await ctx.send("{}\n{}".format(role_obj.mention, message))

@ -27,9 +27,7 @@ class InfoChannel(Cog):
default_guild = { default_guild = {
"channel_id": None, "channel_id": None,
"category_id": None,
"member_count": True, "member_count": True,
"channel_count": False,
} }
self.config.register_guild(**default_guild) self.config.register_guild(**default_guild)
@ -80,19 +78,15 @@ class InfoChannel(Cog):
overwrites = {guild.default_role: discord.PermissionOverwrite(connect=False), overwrites = {guild.default_role: discord.PermissionOverwrite(connect=False),
guild.me: discord.PermissionOverwrite(manage_channels=True, connect=True)} guild.me: discord.PermissionOverwrite(manage_channels=True, connect=True)}
category: discord.CategoryChannel = await guild.create_category("────Server Stats────", overwrites=overwrites)
channel = await guild.create_voice_channel( channel = await guild.create_voice_channel(
"Placeholder", category=category, reason="InfoChannel make", overwrites=overwrites "Placeholder", reason="InfoChannel make", overwrites=overwrites
) )
await self.config.guild(guild).channel_id.set(channel.id) await self.config.guild(guild).channel_id.set(channel.id)
await self.config.guild(guild).category_id.set(category.id)
await self.update_infochannel(guild) await self.update_infochannel(guild)
async def delete_infochannel(self, guild: discord.Guild, channel: discord.VoiceChannel): async def delete_infochannel(self, guild: discord.Guild, channel: discord.VoiceChannel):
await channel.category.delete(reason="InfoChannel delete")
await channel.delete(reason="InfoChannel delete") await channel.delete(reason="InfoChannel delete")
await self.config.guild(guild).clear() await self.config.guild(guild).clear()
@ -112,9 +106,6 @@ class InfoChannel(Cog):
if guild_data["member_count"]: if guild_data["member_count"]:
name += "Members: {} ".format(guild.member_count) name += "Members: {} ".format(guild.member_count)
if guild_data["channel_count"]:
name += "─ Channels: {}".format(len(guild.channels))
if name == "": if name == "":
name = "Stats not enabled" name = "Stats not enabled"

Loading…
Cancel
Save