command perms
This commit is contained in:
parent
03a7617fd3
commit
e95edf08df
@ -29,6 +29,7 @@ class AuditModel(Base):
|
|||||||
|
|
||||||
id = Column(Integer, primary_key=True, autoincrement=True)
|
id = Column(Integer, primary_key=True, autoincrement=True)
|
||||||
discord_user_id = Column(BigInteger, nullable=False)
|
discord_user_id = Column(BigInteger, nullable=False)
|
||||||
|
discord_server_id = Column(BigInteger, nullable=False)
|
||||||
message = Column(String, nullable=False)
|
message = Column(String, nullable=False)
|
||||||
created = Column(DateTime(timezone=True), server_default=func.now(), nullable=False) # pylint: disable=E1102
|
created = Column(DateTime(timezone=True), server_default=func.now(), nullable=False) # pylint: disable=E1102
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ from typing import Tuple
|
|||||||
import validators
|
import validators
|
||||||
from feedparser import FeedParserDict, parse
|
from feedparser import FeedParserDict, parse
|
||||||
from discord.ext import commands
|
from discord.ext import commands
|
||||||
from discord import Interaction, Embed, Colour, TextChannel
|
from discord import Interaction, Embed, Colour, TextChannel, Permissions
|
||||||
from discord.app_commands import Choice, Group, autocomplete, choices, rename
|
from discord.app_commands import Choice, Group, autocomplete, choices, rename
|
||||||
from sqlalchemy import insert, select, and_, delete
|
from sqlalchemy import insert, select, and_, delete
|
||||||
from sqlalchemy.exc import NoResultFound
|
from sqlalchemy.exc import NoResultFound
|
||||||
@ -20,7 +20,8 @@ from db import ( # pylint: disable=E0401
|
|||||||
DatabaseManager,
|
DatabaseManager,
|
||||||
SentArticleModel,
|
SentArticleModel,
|
||||||
RssSourceModel,
|
RssSourceModel,
|
||||||
FeedChannelModel
|
FeedChannelModel,
|
||||||
|
AuditModel
|
||||||
)
|
)
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
@ -146,7 +147,8 @@ class FeedCog(commands.Cog):
|
|||||||
feed_group = Group(
|
feed_group = Group(
|
||||||
name="feed",
|
name="feed",
|
||||||
description="Commands for rss sources.",
|
description="Commands for rss sources.",
|
||||||
guild_only=True # We store guild IDs in the database, so guild only = True
|
guild_only=True, # We store guild IDs in the database, so guild only = True
|
||||||
|
default_permissions=Permissions.elevated()
|
||||||
)
|
)
|
||||||
|
|
||||||
@feed_group.command(name="add")
|
@feed_group.command(name="add")
|
||||||
@ -652,9 +654,10 @@ class FeedCog(commands.Cog):
|
|||||||
await followup(inter, embed=embed)
|
await followup(inter, embed=embed)
|
||||||
|
|
||||||
admin_group = Group(
|
admin_group = Group(
|
||||||
parent=feed_group,
|
|
||||||
name="admin",
|
name="admin",
|
||||||
description="Administration tasks"
|
description="Administration tasks",
|
||||||
|
guild_only=True,
|
||||||
|
default_permissions=Permissions.elevated()
|
||||||
)
|
)
|
||||||
|
|
||||||
@admin_group.command(name="clear-sent-articles")
|
@admin_group.command(name="clear-sent-articles")
|
||||||
@ -681,7 +684,30 @@ class FeedCog(commands.Cog):
|
|||||||
"again if they appear during the next RSS feed scan."
|
"again if they appear during the next RSS feed scan."
|
||||||
)
|
)
|
||||||
|
|
||||||
audit_group
|
audit_group = Group(
|
||||||
|
name="audit",
|
||||||
|
description="Check audited actions.",
|
||||||
|
guild_only=True,
|
||||||
|
default_permissions=Permissions.elevated()
|
||||||
|
)
|
||||||
|
|
||||||
|
@audit_group.command(name="check")
|
||||||
|
async def check_audit_log(self, inter: Interaction):
|
||||||
|
"""Check the audit log.
|
||||||
|
|
||||||
|
Parameters
|
||||||
|
----------
|
||||||
|
inter : Interaction
|
||||||
|
Represents an app command interaction.
|
||||||
|
"""
|
||||||
|
|
||||||
|
await inter.response.defer()
|
||||||
|
|
||||||
|
async with DatabaseManager() as database:
|
||||||
|
query = select(AuditModel).where(and_(
|
||||||
|
))
|
||||||
|
result = await database.session.execute(query)
|
||||||
|
|
||||||
|
|
||||||
async def setup(bot):
|
async def setup(bot):
|
||||||
"""
|
"""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user