original_docstring: Retrieves new plugin store plugins and publishes them to TheoTown guild channel.
docstring: Retrieves new plugin store plugins and publishes them to TheoTown guild channel.
docstring_tokens: Retrieves new plugin store plugins and publishes them to TheoTown guild channel .
code: async def retrieve_new_plugins(self) -> None:
          """Retrieves new plugin store plugins and publishes them to TheoTown guild channel."""
          try:
              last_approval_time = self.client.persistent_data.data.get("last plugin approval", -1)
  
              plugins = await self.api.get_new_plugins(last_approval_time)
  
              if len(plugins) == 0:
                  self.new_plugins_cache = []
                  return
  
              latest_approval_time = plugins[0].time
  
              if latest_approval_time > last_approval_time:
  
                  self.client.persistent_data.data.update({"last plugin approval": latest_approval_time})
                  self.client.persistent_data.save()
  
                  for plugin in plugins:
  
                      if plugin.id in self.new_plugins_cache:
                          continue
                      self.new_plugins_cache.append(plugin.id)
  
                      message = await self.showcase_channel.send(embed=plugin.to_embed())
  
                      await message.add_reaction(emoji="👍")
                      await message.add_reaction(emoji="👎")
  
                      if self.use_threads:
                          thread = await message.create_thread(name=f"{truncate_string(plugin.clean_title, 89)} discussion", auto_archive_duration=60)
                          await self.api.create_new_plugin_thread(thread.id, timedelta_to_datetime(timedelta(days=7)).timestamp())
          except ServerDisconnectedError:
              self.client.logger.exception("An server disconnection was encountered while trying to retrieve and publish new plugin information")
          except Exception as e:
              self.client.logger.exception("An exception was encountered while trying to retrieve and publish new plugin information")
              traceback.print_exception(type(e), e, e.__traceback__, file=sys.stderr)
code_tokens: async def retrieve_new_plugins ( self ) -> None : try : last_approval_time = self . client . persistent_data . data . get ( "last plugin approval" , - 1 ) plugins = await self . api . get_new_plugins ( last_approval_time ) if len ( plugins ) == 0 : self . new_plugins_cache = [ ] return latest_approval_time = plugins [ 0 ] . time if latest_approval_time > last_approval_time : self . client . persistent_data . data . update ( { "last plugin approval" : latest_approval_time } ) self . client . persistent_data . save ( ) for plugin in plugins : if plugin . id in self . new_plugins_cache : continue self . new_plugins_cache . append ( plugin . id ) message = await self . showcase_channel . send ( embed = plugin . to_embed ( ) ) await message . add_reaction ( emoji = "👍")  await message . add_reaction ( emoji = "👎")  if self . use_threads : thread = await message . create_thread ( name = f"{truncate_string(plugin.clean_title, 89)} discussion" , auto_archive_duration = 60 ) await self . api . create_new_plugin_thread ( thread . id , timedelta_to_datetime ( timedelta ( days = 7 ) ) . timestamp ( ) ) except ServerDisconnectedError : self . client . logger . exception ( "An server disconnection was encountered while trying to retrieve and publish new plugin information" ) except Exception as e : self . client . logger . exception ( "An exception was encountered while trying to retrieve and publish new plugin information" ) traceback . print_exception ( type ( e ) , e , e . __traceback__ , file = sys . stderr )
short_docstring: Retrieves new plugin store plugins and publishes them to TheoTown guild channel.
short_docstring_tokens: Retrieves new plugin store plugins and publishes them to TheoTown guild channel .
comment: """Retrieves new plugin store plugins and publishes them to TheoTown guild channel."""