markweirath/big-brother-bot

ADV plugin : get messages from a remote text file

Opened this issue · 0 comments

The ADV plugin already knows how to get the messages of a local text file (although this feature is not documented in the plugin config file) and it was suggested to get the messages of a remote text file over HTTP or FTP.

This should not be to difficult to implement as a similar feature already exists in B3 or B3 plugins (banlist plugin for instance)

Maybe a new xml tag could be created for making more clear how to use files to hold messages. What about the <file> tag ? A config file could then be :

<configuration plugin="adv">
    <!--
        Note: within ads, you can use the following variables : @nextmap @time
        or rules as defined in the admin plugin config file. ie: /spam#rule1
    -->
    <settings name="settings">
        <!-- rate in minutes. 
          If you want a rate faster than once 
          per minutes, then you can add a 's' as a suffix for seconds.
          i.e. : <set name="rate">30s</set> 
        -->
        <set name="rate">2</set>
        <!--
            you can either set here a text file that will contain one ad per line
            or fill the <ads> section below
        -->
        <!-- <set name="ads">c:/somewhere/my_ads.txt</set> -->
    </settings>
  <settings name="newsfeed">
        <!--
            you can include newsitems in your adds by setting the section below
            you can add feeditems in the adds like this:
            @feed   (will pick the next newsitem each time it is included in the rotation,
               rotating until 'items' is reached and then start over.)
            @feed 0 (will pick the latest newsitem available from the feed and add it in the rotation)
            @feed 1 (will pick the second latest item in line)
            etc.
        -->
        <set name="url"><![CDATA[http://forum.bigbrotherbot.net/news-2/?type=rss;action=.xml]]></set>
        <set name="items">5</set>
        <set name="pretext">News: </set>
    </settings>
    <ads>
    <!-- You can use two tags : <ad> or <file>
      The <ad> tag is used to write a message right in this config file.
      The <file> tag is used to specify a local or remote text file that contains one message per line
    -->
    <!-- you can use the following keywords in your messages :
      /spam#rule1 - rule 1 as defined in you admin plugin config file
      @time - the server time
      @feed - the next RSS feed item
      @feed 0 - the lastest RSS feed item
      @feed 1 - the 2nd lastest RSS feed item
      @nextmap - the next map in your game server rotation list (if available)
      @topstats - the top stats from XLRstats (if the plugin is enabled)
      @admins - connected admins' names. You can change the message format in your admin plugin config
    -->
        <ad>^2Big Brother Bot is watching you... www.BigBrotherBot.net</ad>
        <ad>@feed</ad>
        <ad>server watched by @admins</ad>
        <ad>/spam#rule1</ad>
        <ad>@time</ad>
        <ad>@admins</ad>
        <ad>@feed</ad>
        <ad>^2Do you like B3? Consider donating to the project at www.BigBrotherBot.net</ad>
        <ad>@nextmap</ad>
        <ad>@topstats</ad>
        <file>C:\somewhere\b3-ads.txt</file>
        <file>FTP://myuser:mypassword@11.22.33.44/somewhere/b3-ads.txt</file>
        <file>HTTP://11.22.33.44/somewhere/b3-ads.txt</file>
    </ads>
</configuration>