Esempio n. 1
0
 def reset_moderator_roles(self, server_id):
     try:
         server_setting = self.session.query(
             coremodels.ServerSetting).filter(
                 coremodels.ServerSetting.server_id == server_id).one()
         server_setting.moderator_roles = []
     except sqlalchemy.orm.exc.NoResultFound:
         LOGGER.warning(f"No Settings for server_id {server_id}")
Esempio n. 2
0
 def get_poll(self, poll_id: str) -> Union[poll_models.Poll, None]:
     try:
         poll = self.session.query(poll_models.Poll).filter(
             poll_models.Poll.poll_id == poll_id).one()
     except sqlalchemy.orm.exc.NoResultFound:
         LOGGER.warning("Poll with ID %d does not exist" % poll_id)
         return None
     return poll
Esempio n. 3
0
 def reset_prefix(self, server_id: int) -> None:
     try:
         server_setting = self.session.query(
             coremodels.ServerSetting).filter(
                 coremodels.ServerSetting.server_id == server_id).one()
         server_setting.prefix = None
     except sqlalchemy.orm.exc.NoResultFound:
         LOGGER.warning(f"No Settings for server_id {server_id}")
Esempio n. 4
0
 def get_poll_with_message_id(
         self, message_id: int) -> Union[poll_models.Poll, None]:
     try:
         poll = self.session.query(poll_models.Poll).filter(
             or_(poll_models.Poll.sent_message == str(message_id),
                 poll_models.Poll.received_message == str(
                     message_id))).one()
         return poll
     except sqlalchemy.orm.exc.NoResultFound:
         LOGGER.warning(
             "Poll with poll_message or trigger_message ID %d does not exist"
             % message_id)
     return None