Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
config.json
# IDEs
.idea/

# Byte-compiled / optimized / DLL files
__pycache__/
Expand Down
34 changes: 34 additions & 0 deletions src/cogs/boostrolemanager.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import nextcord
from nextcord.ext import commands
from nextcord import Forbidden, HTTPException

class BoostTracker(commands.Cog):
def __init__(self, bot):
self.bot = bot

@commands.Cog.listener()
async def on_member_update(self, before, after):
if (before.premium_since is None) == (after.premium_since is None) or after.premium_since:
return

roles_to_remove = [
"nitro-a",
"nitro-b",
"nitro-c",
"nitro-d",
"nitro-e",
"nitro-f"
]

try:
for role_name in roles_to_remove:
role = nextcord.utils.get(after.guild.roles, name=role_name)
if role not in after.roles: continue
await after.remove_roles(role)
except Forbidden as e:
print(f'Insufficient permissions: {e}')
except HTTPException as e:
print(f'HTTP request failed: {e}')

def setup(bot):
bot.add_cog(BoostTracker(bot))
1 change: 1 addition & 0 deletions src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
# "cogs.threads",
"cogs.rolereact",
"cogs.logs",
"cogs.boostrolemanager",

]

Expand Down