Example #1
0
def server_uuid_map(match, entry, unused):
  username = match.group(1)
  uuid = match.group(2)
  
  users.setuuid_byname(username, uuid)
  users.getuser_byname(username)
  saveconfig()
Example #2
0
def server_chat_message(match, entry, unused):
  # A chat message was received
  chatter = match.group(1)
  chatmsg = match.group(2)
  print("<" + chatter + "> " + chatmsg)

  if chatmsg.startswith("!"):
    runcmd(users.getuser_byname(chatter), chatmsg[1:])
Example #3
0
def cmd_punish(match, entry, userinfo):
  targetname = match.group(1)
  if permissions.is_allowed(userinfo, { "minimum_standing": 100 }, "Trying to punish " + targetname):
    rewards.punish(users.getuser_byname(targetname), {
      "reason": "Unspecified reason",
      "level": 1
    })
  return True # No more processing from command list
Example #4
0
def twitch_chat_message(match, entry, unused):
  # A chat message was received
  chatter = "twitch:" + match.group(1)
  chatmsg = match.group(2)

  userinfo = users.getuser_byname(chatter)

  if "optin" in userinfo and userinfo["optin"]:
    print("<" + chatter + "> " + chatmsg)

    if chatmsg.startswith("!"):
      runcmd(userinfo, chatmsg[1:])

    externals.minecraft.say("<" + chatter + "> " + chatmsg)

  else:
    regexhandling.handle_rlist(chatmsg, twitchonly_rlist, userinfo)
Example #5
0
]

###################################

# Infinite loop
while True:

  ##################### Direct console command stuff ######################

  # Get one line from text window (stdin of python program)
  line = externals.stdin.getline()

  # Check that line is not empty
  if line != "":
    print("Got cmdline from main window: " + line)
    runcmd(users.getuser_byname("server"), line)


  ##################### Twitch chat stuff ######################

  # Get a single line from the Twitch chat
  line = externals.twitch.getline()

  # Check that line is not empty
  if line != "":
    regexhandling.handle_rlist(line, twitch_rlist, None)


  ##################### Server log stuff ######################

  # Get a single line from the Minecraft server