@@ 160-175 (lines=16) @@ | ||
157 | await user.send(f"You were banned from {ctx.guild.name}\nReason: {reason}") |
|
158 | ||
159 | # Softban |
|
160 | @cog_ext.cog_slash(name="softban", guild_ids=cogbase.GUILD_IDS, |
|
161 | description="Bans and unbans the user, so their messages are deleted", |
|
162 | default_permission=False, |
|
163 | permissions=cogbase.PERMISSION_MODS) |
|
164 | async def kick(self, ctx, user: discord.Member, *, reason=None): |
|
165 | if user == ctx.author: |
|
166 | return await ctx.send( |
|
167 | f"{user.mention} You can't softban yourself", delete_after=5.0) |
|
168 | await user.ban(reason=reason) |
|
169 | await user.unban(reason=reason) |
|
170 | if not reason: |
|
171 | await ctx.send(f"{user} was softbanned", delete_after=10.0) |
|
172 | await user.send(f"You were softbanned from {ctx.guild.name}") |
|
173 | else: |
|
174 | await ctx.send(f"{user} was softbanned \nReason: {reason}", delete_after=10.0) |
|
175 | await user.send(f"You were softbanned from {ctx.guild.name}\nReason: {reason}") |
|
176 | ||
177 | # CHANNEL NAMES UPDATES |
|
178 | # Total member channel name |
|
@@ 143-157 (lines=15) @@ | ||
140 | ||
141 | # TODO: Remove code repetition? |
|
142 | # Ban |
|
143 | @cog_ext.cog_slash(name="ban", guild_ids=cogbase.GUILD_IDS, |
|
144 | description="Bans member from the server", |
|
145 | default_permission=False, |
|
146 | permissions=cogbase.PERMISSION_ADMINS) |
|
147 | async def kick(self, ctx, user: discord.Member, *, reason=None): |
|
148 | if user == ctx.author: |
|
149 | return await ctx.send( |
|
150 | f"{user.mention} You can't ban yourself", delete_after=5.0) |
|
151 | await user.ban(reason=reason) |
|
152 | if not reason: |
|
153 | await ctx.send(f"{user} was banned", delete_after=10.0) |
|
154 | await user.send(f"You were banned from {ctx.guild.name}") |
|
155 | else: |
|
156 | await ctx.send(f"{user} was banned \nReason: {reason}", delete_after=10.0) |
|
157 | await user.send(f"You were banned from {ctx.guild.name}\nReason: {reason}") |
|
158 | ||
159 | # Softban |
|
160 | @cog_ext.cog_slash(name="softban", guild_ids=cogbase.GUILD_IDS, |
|
@@ 125-139 (lines=15) @@ | ||
122 | # KICK FUNCTIONS |
|
123 | ||
124 | # Kick |
|
125 | @cog_ext.cog_slash(name="kick", guild_ids=cogbase.GUILD_IDS, |
|
126 | description="Kicks member from the server", |
|
127 | default_permission=False, |
|
128 | permissions=cogbase.PERMISSION_MODS) |
|
129 | async def kick(self, ctx, user: discord.Member, *, reason=None): |
|
130 | if user == ctx.author: |
|
131 | return await ctx.send( |
|
132 | f"{user.mention} You can't kick yourself", delete_after=5.0) |
|
133 | await user.kick(reason=reason) |
|
134 | if not reason: |
|
135 | await ctx.send(f"{user} was kicked", delete_after=10.0) |
|
136 | await user.send(f"You were kicked from {ctx.guild.name}") |
|
137 | else: |
|
138 | await ctx.send(f"{user} was kicked\nReason: {reason}", delete_after=10.0) |
|
139 | await user.send(f"You were kicked from {ctx.guild.name}\nReason: {reason}") |
|
140 | ||
141 | # TODO: Remove code repetition? |
|
142 | # Ban |