-
Notifications
You must be signed in to change notification settings - Fork 23
feature/botmoderation #296
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| from datetime import datetime, timedelta | ||
|
|
||
| import discord | ||
| from discord import Color, Embed | ||
| from discord.ext.commands import Bot, Cog | ||
|
|
||
| from config import CONFIG | ||
|
|
||
|
|
||
| class Database(Cog): | ||
| def __init__(self, bot: Bot): | ||
| self.bot = bot | ||
|
|
||
| @Cog.listener() | ||
| async def on_message(self, message: discord.Message): | ||
| joined_recently = message.author.joined_at > datetime.now() - timedelta(days=7) | ||
| contains_everyone = '@everyone' in message.content | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does the text in the message for an @ everyone actually come out as @ everyone? I know pings of roles/people are <@12356789>?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes it does, as if they don't have the permission it just formats to @ everyone, in terms of actual @ everyone pings, it does the same |
||
| is_giving_away = 'giving away' in message.content.lower() | ||
|
|
||
| if not joined_recently or not (contains_everyone or is_giving_away): | ||
| return | ||
|
|
||
| channel = self.bot.get_channel(CONFIG.UWCS_BOT_LOG_CHANNEL_ID) | ||
|
|
||
| embed_colour = Color.from_rgb(61, 83, 255) | ||
| embed_title = f'@{message.author.global_name}, ID: {message.author.id}' | ||
| embed_description = f'User suspected to be a bot, joined_recently: {joined_recently}, contains_everyone: {contains_everyone}, is_giving_away: {is_giving_away}' | ||
| embed = Embed( | ||
| title=embed_title, color=embed_colour, embed_description=embed_description | ||
| ) | ||
|
|
||
| await message.delete() | ||
| await channel.send(f'<@&{CONFIG.UWCS_EXEC_ROLE_IDS[1]}>', embed=embed) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why take the 2nd role? That feels unintuitive at best - create a separate config param if you want it to be a specific role (that isn't just exec)
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i don't know? ask whoever put the exec role as the second role in the list... |
||
| await message.author.timeout(timedelta(days=1)) | ||
|
|
||
| async def setup(bot: Bot): | ||
| await bot.add_cog(Database(bot)) | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is the cog called database?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fuck, that's actually my bad