Paste #49237: Untitled Paste

Date: 2018/08/20 13:19:56 UTC-07:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


#connect the bot and reload
connect_vote_counter:
  type: world
  events:
    on server start:
    - discord id:vote connect code:token
    on system time hourly:
    - discord id:vote disconnect
    - discord id:vote connect code:NDgwNDI2NzQ3NzU0NTc3OTIw.DlnpKw.FuwRmUCZUqPOcR7L-KrpqWQJllc
    - discord id:vote message channel:480429497703989258 "**Bot realoaded**"
    on votifier vote:
    - discord id:vote message channel:480429497703989258 "**[<c.service>] <c.username> just voted. (<c.time>)**"

vote_count_yaml:
  type: world
  events:
    on server start:
    - if <server.has_file[/vote_counts/<util.date.time.month>,<util.date.time.year>.yml]> {
      - yaml "load:/vote_counts/<util.date.time.month>,<util.date.time.year>" id:<util.date.time.month>,<util.date.time.year>
      } 
      else {
      - yaml create id:<util.date.time.month>,<util.date.time.year>
      }
    on shutdown:
    - yaml "savefile:/vote_counts/<util.date.time.month>,<util.date.time.year>.yml" id:<util.date.time.month>,<util.date.time.year>
    on system time 11:59:
    - announce "<&8>[<&6>Auto Restart<&8>] <&4>Restarting the server in one minute."
    - wait 1m
    - execute as_server "restart"
    on vote votifier:
    - yaml id:<util.date.time.month>,<util.date.time.year> set votes.<context.username>/:++

vstart:
  type: command
  name: vstart
  script:
  - if <server.has_file[/vote_counts/<util.date.time.month>,<util.date.time.year>.yml]> {
    - yaml "load:/vote_counts/<util.date.time.month>,<util.date.time.year>" id:<util.date.time.month>,<util.date.time.year>
    } 
    else {
    - yaml create id:<util.date.time.month>,<util.date.time.year>
    }