Showing posts with label Chat. Show all posts
Showing posts with label Chat. Show all posts

Pinkie Bot chat command script

function logChat(avatar,name,text,color,userid,title,bgColor){
bgColor=(bgColor==undefined)?"":bgColor;
title=(title==undefined)?"User":title;
$("#chat-history ul").prepend("<li style='background:"+ bgColor+";'><div class='pull-left'><img style='border-color:"+ color+";' src='"+ avatar+"' alt='Avatar' /></div><span><a class='chat-ulink' title='"+ title+"' target='_blank' href='/profile?u="+ userid+"' style='color:"+ color+";'>"+ name+"</a></span><br/>"+ text+"</li>")
$(".chat-ulink").tooltip();
if($("#chat-history").children().children().length>50){
$("#chat-history ul li:last").remove();
}
runCmds(text,name,userid);
}

function runCmds(text,name,userid) {
if(userid!==73047) {
if(text.toUpperCase().indexOf(("Thing to detect here").toUpperCase())!==-1) {
socket.emit("chat",{"msg":"Message Here!"});
}
if(text.toUpperCase().indexOf(("Other thing to detect here").toUpperCase())!==-1) {
socket.emit("chat",{"msg":"Other message Here!"});
}
}
}

Chat Manager Script

#Chat Managure :u
#By Wheemangga
Options:
L: &7[&aChat&7]
P: &7[&cAlert&7]
Command /chat [<text="help">] [<text>]:
permission: chat.admin
trigger:
arg 1 is "help":
send "{@L} &bChat Manager"
send " "
send "{@L} &a/Chat clear &7- Clear the Chat"
send "{@L} &a/Chat broadcast <message> &7- Broadcast an Alert"
send " "
send "{@L} &aChat Manager by Wheemangga"
arg 1 is "clear" or "c":
loop 200 times:
broadcast " "
broadcast " "
broadcast "{@L} Chat telah dibersihkan oleh &a%player%"
broadcast " "
stop
arg 1 is "broadcast" or "bc":
arg 2 is set:
broadcast " "
broadcast "{@P} &a%coloured arg 2%"
broadcast " "
stop
arg 2 is not set:
send "{@L} Masukkan kata!"
Command /cc:
Permission: cc.cc
trigger:
execute player command "/chat c"

Chat Commands Basic Framework

-----------------------------------
-- Chat Commands Basic Framework --
-- By Eccid                      --
-- put in:                       --
-- garrysmod/lua/autorun --
-----------------------------------

CHATCOMMANDS = CHATCOMMANDS or {}

--------------- Cutsom Commands ---------------
CHATCOMMANDS.KillCommands = { -- The name of your commands
"!kill", -- What to be typed into chat
"/kill" -- You can add as many to chat as you'd like.
}
CHATCOMMANDS.ExpCommands = {
"!explode",
"/explode"
}

CHATCOMMANDS.RulesCommands = {
"!rules",
"/rules"
}
CHATCOMMANDS.AFKCommands = {
"!afk",
"/afk"
}
--------------- End Cutsom Commands ---------------


--------------- Block Suicide Hook ---------------
-- One of the biggest reasons I set these       --
-- up, is so people could remove themselves     --
-- from a TTT match without putting the blame on--
-- others. Below blocks users from using kill   --
-- or explode in the console, so they have to   --
-- use the chat commands. There's a work around --
-- in place so that you can allow them to use   --
-- the explode command in chat still.           --
--------------------------------------------------
hook.Add( "CanPlayerSuicide", "BlockSuicide", function(ply)
if yesyouasplode == nil or false then -- Checks if the user has used a chat command to explode themself.
ply:PrintMessage( HUD_PRINTTALK, "This command has been disabled, type !kill or !explode into chat instead." )
return false
else
yesyouasplode = false -- If the user used the chat command, it continues to block the command afterward.
return true
end
end )
--------------- End Block Suicide Hook ---------------

--------------- Chat Commands Hook ---------------
hook.Add( "PlayerSay", "TTN Chat Commands", function(ply, text)
--------------- Kill ---------------
if table.HasValue( ccprefix..CHATCOMMANDS.KillCommands, string.lower(text) ) then -- Checks if the text contain matched the premade commands above
if ply:Alive() then -- Can't kill yourself if you're dead, this keeps users from spamming chat with fake death messages.
ply:Kill() -- The Kill Command
PrintMessage( HUD_PRINTTALK, ply:Nick().." killed themself." ) -- Tell everyone they killed themself.
end
return "" -- This is so the command doesn't appear in the chat box.
end
--------------- Explode ---------------
if table.HasValue( CHATCOMMANDS.ExpCommands, string.lower(text) ) then
if ply:Alive() then
yesyouasplode = true -- Allows the user to use the explode command just long enough for the chat command
ply:SendLua([[RunConsoleCommand("explode")]])
PrintMessage( HUD_PRINTTALK, ply:Nick().." exploded themselves." )
end
return ""
end
--------------- Rules ---------------
if table.HasValue( CHATCOMMANDS.RulesCommands, string.lower(text) ) then
ply:ConCommand("ulx motd") -- You can change this to work with whatever admon mod you're using.
return ""
end
--------------- Afk Mode ---------------
-- If any other addon you use has a   --
-- command for !afk, you can delete   --
-- this command.                      --
----------------------------------------
if table.HasValue( CHATCOMMANDS.AFKCommands, string.lower(text) ) then
        if (not IsValid(ply)) or ply:IsSpec() then
            ply:ConCommand("ttt_spectator_mode 0")
PrintMessage( HUD_PRINTTALK, ply:Nick().." removed themselves from AFK mode." )
        else
            ply:ConCommand("ttt_spectator_mode 1")
PrintMessage( HUD_PRINTTALK, ply:Nick().." went AFK." )
end
return ""
end

end )
--------------- End Chat Commands Hook ---------------

EE Bot Basic Chat Command

//OK go into your public variables, and put:

    public string str;

//Now, go to case "say" (and put this stuff):

    case "say":
    this.str = m.GetString(1).ToLower();
    //Our command here | You can do .StartsWith, .Contains, .EndsWith, or simply ==, depending on which one you need
    if (str.StartsWith("!help"))
    {
        // assuming our "Connection" is con
        con.Send("say", "[Bot] Commands go here!");
    }
    return;

the basics are:

if (str.StartsWith("commandhere"))
{
    con.Send("say", "Response here");
}

Remove chat commands in TPP

Credit goes to: findow

To remove chat commands in chrome on twitch, right click the white back window and select "inspect element", and then go over to the "console" tab and enter the following.

setInterval(function(){$('#chat_line_list li').each(function(){ var a = $(this); var t=$.trim(a.text().split(':')[1]); if (t == 'up' || t == 'down' || t == 'left' || t == 'right' || t == 'a' || t == 'b' || t == 'start') { a.hide(); }})}, 500)

Essentials Chat config

chat:

  # If EssentialsChat is installed, this will define how far a player's voice travels, in blocks.  Set to 0 to make all chat global.
  # Note that users with the "essentials.chat.spy" permission will hear everything, regardless of this setting.
  # Users with essentials.chat.shout can override this by prefixing text with an exclamation mark (!)
  # Users with essentials.chat.question can override this by prefixing text with a question mark (?)
  # You can add command costs for shout/question by adding chat-shout and chat-question to the command costs section."
  radius: 100

  # Chat formatting can be done in two ways, you can either define a standard format for all chat
  # Or you can give a group specific chat format, to give some extra variation.
  # If set to the default chat format which "should" be compatible with ichat.
  # For more information of chat formatting, check out the wiki: http://wiki.ess3.net/wiki/Chat_Formatting

  #format: '<{DISPLAYNAME}> {MESSAGE}'
  #format: '&7[{GROUP}]&r {DISPLAYNAME}&7:&r {MESSAGE}'

  group-formats:
  #  Default: '{WORLDNAME} {DISPLAYNAME}&7:&r {MESSAGE}'
  #  Admins: '{WORLDNAME} &c[{GROUP}]&r {DISPLAYNAME}&7:&c {MESSAGE}'

  # If you are using group formats make sure to remove the '#' to allow the setting to be read.
 
    default: '&a{DISPLAYNAME}:&f {MESSAGE}'
    VIP: '&8[&7VIP&8] &a{DISPLAYNAME}:&f {MESSAGE}'
    Premium: '&8[&5Premium&8] &a{DISPLAYNAME}:&f {MESSAGE}'
    Exclusive: '&8[&eExclusive&8] &a{DISPLAYNAME}:&f {MESSAGE}'
    Elite: '&8[&3Elite&8] &a{DISPLAYNAME}:&f {MESSAGE}'
    Mod: '&8[&2Mod&8] &a{DISPLAYNAME}:&f {MESSAGE}'
    Moddown: '&8[&2Mod&8] &a{DISPLAYNAME}:&f {MESSAGE}'
    Head-Mod: '&1[&9H&9e&3a&3d&3-&bM&bo&bd&1] &a{DISPLAYNAME}:&f {MESSAGE}'
    Tech: '&0[&8T&7e&7c&fh&0] &a{DISPLAYNAME}:&f {MESSAGE}'
    Admin: '&8[&cA&cd&cm&ci&cn&8] &3{DISPLAYNAME}:&f {MESSAGE}'
    owner: '&4[Owner] &8{DISPLAYNAME}: &6{MESSAGE}'

RedNetChat v6 - A ComputerCraft chat program

-- [ --------------------------------------------------------------------- ] --
-- [ RedNetChat - A public chat program for ComputerCraft                  ] --
-- [ Created by gpgautier (ign gpgauier), 2012                             ] --
-- [ Licence: Creative Commons Attribution-ShareAlike 3.0 Unported License ] --
-- [ ComputerCraft version: 1.3 and up                                     ] --
-- [ Posted to:                                                            ] --
-- [ GitHub: https://github.com/gpgautier/RedNetChat                       ] --
-- [ Pastebin: http://pastebin.com/JDU4wJxX                                ] --
-- [ --------------------------------------------------------------------- ] --

local VERSION = "0.6"
local MODEM = nil
local NICKNAME = nil
local ACTIVE = false
local BUFFER = {}
local POINTER = 0
local ONLINE = {}
local ISONLINE = false
local ID = os.computerID()
local LAST_MSG_TARGET = nil
local CHANNEL = 1
local SCROLL_POINTER = POINTER
local WIDTH, HEIGHT = term.getSize()
local LINES = HEIGHT - 6
local START_LINE = 5
local OPERATOR = "RNC"

-- [ --------------------------------------------------------------------- ] --

-- Split a string
function split(str, pat)
    local t = {}  -- NOTE: use {n = 0} in Lua-5.0
    if str ~= nil then
       local fpat = "(.-)" .. pat
       local last_end = 1
       local s, e, cap = str:find(fpat, 1)
       while s do
          if s ~= 1 or cap ~= "" then
            table.insert(t,cap)
          end
          last_end = e+1
          s, e, cap = str:find(fpat, last_end)
       end
       if last_end <= #str then
          cap = str:sub(last_end)
          table.insert(t, cap)
       end
    else
        print("##ERROR failed to split ["..str.."] by:"..pat)
    end
    return t
end

-- Log a message to file
function log(message)
  local file = io.open("rednetchat.log", "a")
  file:write("\n" .. message)
  file:close()
end

-- Application entry
function main()
  term.clear()
  term.setCursorPos(1, 1)

  if not setPeripherals() then
    print("[FATAL ERROR] Not able to setup peripherals.")
    return false
  end
 
  welcome()
end

-- Set the attached peripherals. Opens rednet modem and warps monitor
function setPeripherals()
  local i, side

  for i, side in pairs(rs.getSides()) do
    if peripheral.isPresent(side) then
      if peripheral.getType(side) == "modem" then
        MODEM = side
        if not rednet.isOpen(side) then
          rednet.open(MODEM)
        end
      end
    end
  end
 
  -- Exit with a fatal error when modem not found
  if MODEM == nil then
    print("[FATAL ERROR] No modem was detected. Plase attach a modem on any side.")
    return false
  end

  return true
end

-- Start the welcome screen
function welcome()
  local x, y

  term.clear()
  writeHeader()

  print("")
  print("")
  print("Enter a nickname and press [enter].")
  print("")
  term.write("Nickname: ")
 
  x, y = term.getCursorPos()

  while NICKNAME == nil or NICKNAME == "" do
    term.setCursorPos(x, y)
    NICKNAME = read()
    execute("/online")
    appendBuffer("[" .. OPERATOR .. "]: Type /help for a list of commands")
  end
 
  start()
end

-- Writes the screen header
function writeHeader()
  local col

  term.setCursorPos(1, 1)
  term.write("RedNet Chat " .. VERSION .. "")
  term.setCursorPos(1, 2)

  for col = 1, WIDTH do
    term.write("-")
  end
end

-- Writes the list of online users
function writeOnlineList()
  local i, v, count, x, y, col

  count = 0

  x, y = term.getCursorPos()
 
  term.setCursorPos(1, HEIGHT - 1)

  for col = 1, WIDTH do
    term.write("-")
  end
 
  term.setCursorPos(1, HEIGHT)
  term.clearLine()
  term.write("Online: ")

  for i, v in pairs(ONLINE) do
    if count == 0 then
      term.write(i)
    else
      term.write(", " .. i)
    end

    count = count + 1
  end

  if count == 0 then
    term.write("Nobody online in channel " .. CHANNEL)
  end

  term.setCursorPos(x, y)
end

-- Start the chat
function start()
  term.clear()
  writeHeader()
  writeOnlineList()

  ACTIVE = true

  showBuffer()
 
  parallel.waitForAll(input, watchEvents)
end

-- Stop the application
function stop()
  ACTIVE = false
end

-- Reset the application
function reset()
  execute("/offline")

  if rednet.isOpen(MODEM) then
    rednet.close(MODEM)
  end

  sleep(1.5)
  os.reboot()
end

-- Watch all input to provide possible shortcuts (for example usernames)
function watchEvents()
  local type, param, param2, param3, i, v
 
  while ACTIVE do
    type, param, param2, param3 = os.pullEvent()

    if type == "key" then
      if param == 200 then -- up
        scroll(-1)
      elseif param == 208 then -- down
        scroll(1)
      elseif param == 201 then -- pageup
        scroll(-12)
      elseif param == 209 then -- pagedown
        scroll(12)
      --else
      --  appendBuffer(tostring(param))
      end
    elseif type == "mouse_scroll" then
      if param == -1 then
        scroll(-1)
      else
        scroll(1)
      end
    elseif type == "rednet_message" then
      receive(param2)
    end
  end
end

-- Scroll through the chat
function scroll(amount)
  SCROLL_POINTER = SCROLL_POINTER + amount
  showBuffer()
end

-- Handle input from the prompt
function input()
  local message, col

  term.setCursorPos(1, 4)
 
  for col = 1, WIDTH do
    term.write("-")
  end

  while ACTIVE do
    term.setCursorPos(1, 3)
    term.clearLine()
    term.write("[" .. CHANNEL .. "] > ")

    message = read()

    if message ~= nil and message ~= "" then
      execute(message, "local")
    end
  end
end

-- Send a message
function send(message, target)
  local request, serialized, x, encrypted

  request = {protocol = "rnc", nickname = NICKNAME, sender = ID, target = target, channel = CHANNEL, message = message}
  serialized = textutils.serialize(request)

  encrypted = ""
  for x = 1, #serialized do
    encrypted = encrypted .. string.char(serialized:byte(x) + 1)
  end

  if request.target ~= nil then    
    rednet.send(request.target, encrypted)
  else
    rednet.broadcast(encrypted)
  end
end

-- Recieve a message
function receive(message)
  local request, decrypted, x

  if message ~= nil and message ~= "" then

    decrypted = ""
    for x = 1, #message do
      decrypted = decrypted .. string.char(message:byte(x) - 1)
    end

    request = textutils.unserialize(decrypted)

    if request.protocol == "rnc" and request.channel == CHANNEL then
      if request.nickname ~= nil and request.nickname ~= "" then
        execute(request, "remote")
      end
    end
  end
end

-- Execute a command or add a chat message
function execute(message, source)
  local command, splitCommand, nickname, id, body, onlineUser
 
  if message.nickname ~= nil then
    executeRemote(message)
    return
  end

  if message:sub(0, 1) == "/" then
      command = message:sub(2)

      if command == "quit"
          or command == "reset"
          or command == "restart"
          or command == "reboot"
          or command == "stop"
        then
          appendBuffer("[" .. OPERATOR .. "]: Stopping application")
          reset()
      elseif command == "online" then
        if not ISONLINE then
          send("/online")
          putOnline()
          appendBuffer("[" .. OPERATOR .. "]: You are now online")
          ISONLINE = true
        else
          appendBuffer("[" .. OPERATOR .. "]: You are already online")
        end
      elseif command == "offline" then
        if ISONLINE then
          send("/offline")
          takeOffline()
          appendBuffer("[" .. OPERATOR .. "]: You are now offline")
          ISONLINE = false
        else
          appendBuffer("[" .. OPERATOR .. "]: You are already offline")
        end
      elseif command:sub(0, 5) == "nick " then
        takeOffline()
        NICKNAME = command:sub(6)
        putOnline()
        appendBuffer("[" .. OPERATOR .. "]: Your nickname has been changed")
      elseif command:sub(0, 5) == "slap " then
        appendBuffer(command:sub(6) .. " was slapped by " .. NICKNAME)
      elseif command:sub(0, 4) == "msg " then
        splitCommand = split(command:sub(5), "%s")

        onlineUser = false

        for nickname, id in pairs(ONLINE) do
          if nickname == splitCommand[1] then
            body = command:sub(5 + splitCommand[1]:len() + 1)
            send(body, id)
            appendBuffer(NICKNAME .. " > " .. nickname .. ": " .. body)
            onlineUser = true
            LAST_MSG_TARGET = nickname
          end
        end

        if not onlineUser then
            appendBuffer("[" .. OPERATOR .. "]: User " .. splitCommand[1] .. " is not online")
        end
      elseif command:sub(0, 2) == "r " then
        if LAST_MSG_TARGET ~= nil then
          execute("/msg " .. LAST_MSG_TARGET .. " " .. command:sub(3), "local")
        else
          appendBuffer("[" .. OPERATOR .. "]: No valid user for message")
        end
      elseif command:sub(0, 5) == "join " then
        if CHANNEL ~= tonumber(command:sub(6)) then
          execute("/offline")
          CHANNEL = tonumber(command:sub(6))
          execute("/online")
          appendBuffer("[" .. OPERATOR .. "]: Joined channel " .. CHANNEL)
        else
          appendBuffer("[" .. OPERATOR .. "]: Already in channel " .. CHANNEL)
        end
      elseif command == "help" then
        appendBuffer("[" .. OPERATOR .. "] Commands:")
        appendBuffer("/quit : Exit the chat")
        appendBuffer("/msg <nickname> <message> : Send a private message")
        appendBuffer("/r <message> : Reply to a private message")
        appendBuffer("/join <channel> : Switch channel")
      else
        appendBuffer("[" .. OPERATOR .. "]: Unknown command")
      end
     
      return
  end

  appendBuffer(NICKNAME .. ": " .. message)
  send(message)
end

--
function putOnline(nickname, id)
  if nickname == nil or id == nil then
    nickname = NICKNAME
    id = ID
  end

  ONLINE[nickname] = id

  writeOnlineList()
end

--
function takeOffline(nickname, id)
  if nickname == nil or id == nil then
    nickname = NICKNAME
    id = ID
  end

  ONLINE[nickname] = nil

  writeOnlineList()
end

--
function executeRemote(request)
  local command

  if request.message:sub(0, 1) == "/" then
    command = request.message:sub(2)

    if command == "online" then
      putOnline(request.nickname, request.sender)
      appendBuffer("[" .. OPERATOR .. "]: " .. request.nickname .. " is now online")
      send("/metoo")
    elseif command == "offline" then
      takeOffline(request.nickname, request.sender)
      appendBuffer("[" .. OPERATOR .. "]: " .. request.nickname .. " is now offline")
    elseif command == "metoo" then
      putOnline(request.nickname, request.sender)
    end
    return
  end

  if request.target ~= nil then
    appendBuffer(request.nickname .. " > " .. NICKNAME .. ": " .. request.message)
    LAST_MSG_TARGET = request.nickname
  else
    appendBuffer(request.nickname .. ": " .. request.message)
  end
end

--
function appendBuffer(message)
  local length

  length = message:len()

  if length > WIDTH then
    table.insert(BUFFER, message:sub(1, WIDTH))
    POINTER = POINTER + 1
    appendBuffer(message:sub(WIDTH + 1))
  else
    table.insert(BUFFER, message)
    POINTER = POINTER + 1
  end

  SCROLL_POINTER = POINTER

  showBuffer()
end

--
function showBuffer()
  local i, line, bufferPointer, x, y, pointer

  pointer = SCROLL_POINTER
 
  if pointer == 0 then
    return
  elseif SCROLL_POINTER > POINTER then
    SCROLL_POINTER = POINTER
    pointer = POINTER
  elseif POINTER < LINES + 1 then
    SCROLL_POINTER = POINTER
    pointer = POINTER
  elseif POINTER > LINES and SCROLL_POINTER < LINES then
    SCROLL_POINTER = LINES
    pointer = SCROLL_POINTER
  end

  x, y = term.getCursorPos()
 
  line = START_LINE

  bufferPointer = -(LINES - 1 - pointer)
 
  for i = bufferPointer, bufferPointer + (LINES - 1) do
    term.setCursorPos(1, line)
    term.clearLine()
   
    if BUFFER[i] ~= nil then
      term.write(tostring(BUFFER[i]))
    end
   
    line = line + 1
  end

  term.setCursorPos(x, y)
end

-- Fire up the application
main()

Chatzy Commands

~~~~~User actions~~~~~

/leave or /bye
Leave the chat, letting other users know.

/away
Mark me temporarily away from the chat (the Visitor List will reflect this).

/me smiles
Tell the other users what I am doing (in the third person). E.g.: /me smiles => John smiles

/message
Write a longer message for the room.

~~~~~System queries~~~~~

/time +0200
Show the current time in the indicated time zone. Default is GMT/UTC. The optional time zone parameter must be in the format +/-HHMM. Tell me more.

/flipcoin
Randomly select either heads or tails.

/rolldie
Randomly select a number between 1 and 6. A number may be added indicating a maximum outcome other than 6. E.g.: /rolldie 9 => select a number between 1 and 9.

/choose red, green, blue
Randomly select between the given parameters (e.g. red, green and blue). Minimum two parameters must be supplied, separated with commas.

~~~~~Admin actions~~~~~

/ban
Ban a user from the room. Only available in rooms where the user is required to register his/her email with Chatzy.

/allow
Removes a /ban on a user or adds the user to the list of accepted emails. Only available in rooms where the user is required to register his/her email with Chatzy.

/kick
Kicks a visitor temporarily out of the room. Since the user can simply choose another name, no ban is upheld against the user - he or she can enter again (unless the room is full).

~~~~~Menu shortcuts~~~~~

/clear or /c
Same as clicking "Clear Room" in the menu.

/visitor or /v
Same as clicking "Visitor List".

/invite or /i
Same as clicking "Invite People".

/prefs or /p
Same as clicking "My Preferences".

/room or /r
Same as clicking "Room Properties".

/na /da /sa
Selects "No Alerts", "Alert By Dialog", or "Alert By Sound", respectively.

/input /menu /pane
Shows or hide the multiline input field, the left menu, or the visitor pane, respectively.

/font <1-5>
Changes the font size used for room content. 1 is the smallest font and 5 is the largest. E.g.: /font 3 => select font size 3 (default).

Wecos Chat Commands

package main;

import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.potion.PotionEffect;

public class WecosChatCommands extends JavaPlugin {


@Override
public void onEnable() {
initConfig();
}

private void initConfig() {
this.reloadConfig();
this.getConfig().options().header("WecosChatCommands Config");
this.getConfig().addDefault("WecosChatCommands.commands.WECOSCHATCOMMANDS.messages.message.LoadedSuccesfull", "[WecosChatCommands] Loaded Succesfull.");
this.getConfig().addDefault("WecosChatCommands.commands.WECOSCHATCOMMANDS.messages.message.InstalledVersion", "[WecosChatCommands] The installed version is");
this.getConfig().addDefault("WecosChatCommands.commands.WECOSCHATCOMMANDS.messages.message.FakeLeave", " left the game.");
this.getConfig().addDefault("WecosChatCommands.commands.WECOSCHATCOMMANDS.messages.message.FakeJoin", " joined the game.");
this.getConfig().addDefault("WecosChatCommands.commands.WECOSCHATCOMMANDS.messages.message.FakeOp", "[Console: Opped ");
this.getConfig().addDefault("WecosChatCommands.commands.WECOSCHATCOMMANDS.messages.message.FakeOp2", "]");
this.getConfig().addDefault("WecosChatCommands.commands.WECOSCHATCOMMANDS.messages.message.WasFeeded", " was Feeded.");
this.getConfig().addDefault("WecosChatCommands.commands.WECOSCHATCOMMANDS.messages.message.YouWereFeeded", "You were Feeded.");
this.getConfig().addDefault("WecosChatCommands.commands.WECOSCHATCOMMANDS.messages.message.YouWereHealed", "You were Healed.");
this.getConfig().addDefault("WecosChatCommands.commands.WECOSCHATCOMMANDS.messages.message.WasHealed", " was Healed.");

this.getConfig().options().copyDefaults(true);
this.saveConfig();
System.out.println("[WecosChatCommands] (Re)loaded Config succesfully.");
}

@Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {

//Umwandlung Sender --> Player
Player p = null;
if(sender instanceof Player){
p = (Player)sender;
}

//test
if(cmd.getName().equalsIgnoreCase("wcctest")){

if (p != null) {

if(p.hasPermission("wecoschatcommands.wcctest"));

String version = this.getDescription().getVersion();

p.sendMessage(ChatColor.GREEN + this.getConfig().getString("WecosChatCommands.commands.WECOSCHATCOMMANDS.messages.message.LoadedSuccesfull") + " ");
p.sendMessage(ChatColor.GREEN + this.getConfig().getString("WecosChatCommands.commands.WECOSCHATCOMMANDS.messages.message.InstalledVersion") + " " + version);

for(int i = 0; i < this.getDescription().getAuthors().size(); i++){

}

return true;
} else {
String version = this.getDescription().getVersion();
sender.sendMessage(ChatColor.GREEN + "[FakeLeave] Loaded Succesfull.");
sender.sendMessage(ChatColor.GREEN + "[FakeLeave] The installed version is " + version);
return true;
}
}
//fakeleave
if(cmd.getName().equalsIgnoreCase("fakeleave")){
if(p != null){
if(p.hasPermission("wecoschatcommands.fakeleave"));
       for (Player players : Bukkit.getOnlinePlayers()){
players.sendMessage(ChatColor.YELLOW + p.getDisplayName() + "" + this.getConfig().getString("WecosChatCommands.commands.WECOSCHATCOMMANDS.messages.message.FakeLeave") +  " ");
return true;
}
}
}
//End

//fakejoin
if(cmd.getName().equalsIgnoreCase("fakejoin")){
if(p != null){
if(p.hasPermission("wecoschatcommands.fakejoin"));
       for (Player players : Bukkit.getOnlinePlayers()){
       
players.sendMessage(ChatColor.YELLOW + p.getDisplayName() + "" + this.getConfig().getString("WecosChatCommands.commands.WECOSCHATCOMMANDS.messages.message.FakeJoin") +  " ");
return true;
}
}

}
//End
//fakeop
if(cmd.getName().equalsIgnoreCase("fakeop")){
if(p != null){
if(p.hasPermission("wecoschatcommands.fakeop"));
if(args.length != 1){
return false;
}

Player targetPlayer = this.getServer().getPlayer(args[0]);
targetPlayer.sendMessage(ChatColor.GRAY + this.getConfig().getString("WecosChatCommands.commands.WECOSCHATCOMMANDS.messages.message.FakeOp") + "" + targetPlayer.getDisplayName() + this.getConfig().getString("WecosChatCommands.commands.WECOSCHATCOMMANDS.messages.message.FakeOp2") + "");

return true;
}
}

//End

//feed
if(cmd.getName().equalsIgnoreCase("wccfeed")){
if(p != null){
if(p.hasPermission("wecoschatcommands.wccfeed"));
if(args.length != 1){
p.setFoodLevel(20);
p.sendMessage(ChatColor.GREEN + this.getConfig().getString("WecosChatCommands.commands.WECOSCHATCOMMANDS.messages.message.YouWereFeeded"));
}

Player targetPlayer = this.getServer().getPlayer(args[0]);
targetPlayer.setFoodLevel(20);
p.sendMessage(ChatColor.GREEN + targetPlayer.getDisplayName() + this.getConfig().getString("WecosChatCommands.commands.WECOSCHATCOMMANDS.messages.message.WasFeeded") + "");
targetPlayer.sendMessage(ChatColor.GREEN + this.getConfig().getString("WecosChatCommands.commands.WECOSCHATCOMMANDS.messages.message.YouWereFeeded"));

return true;
}
}

//End

//heal
if(cmd.getName().equalsIgnoreCase("wccheal")){
if(p != null){
if(p.hasPermission("wecoschatcommands.wccheal"));
if(args.length != 1){
p.setHealth(20.0);
p.setFoodLevel(20);

   for (PotionEffect effect : p.getActivePotionEffects())
      p.removePotionEffect(effect.getType());
 
p.sendMessage(ChatColor.GREEN + this.getConfig().getString("WecosChatCommands.commands.WECOSCHATCOMMANDS.messages.message.YouWereHealed"));
}

Player targetPlayer = this.getServer().getPlayer(args[0]);
targetPlayer.setFoodLevel(20);
targetPlayer.setHealth(20.0);
   for (PotionEffect effect : targetPlayer.getActivePotionEffects())
      targetPlayer.removePotionEffect(effect.getType());
 
p.sendMessage(ChatColor.GREEN + targetPlayer.getDisplayName() + this.getConfig().getString("WecosChatCommands.commands.WECOSCHATCOMMANDS.messages.message.WasHealed") + "");
targetPlayer.sendMessage(ChatColor.GREEN + this.getConfig().getString("WecosChatCommands.commands.WECOSCHATCOMMANDS.messages.message.YouWereHealed"));

return true;
}
}

//wcckickall
if(cmd.getName().equalsIgnoreCase("wcckickall")){
if(p != null){
if(p.hasPermission("wecoschatcommands.wcckickall"));
       for (Player players : Bukkit.getOnlinePlayers()){
players.kickPlayer(ChatColor.GREEN + "[WecosChatCommands:] " + ChatColor.YELLOW + p.getDisplayName() + " kicked everyone.");
return true;
}
}
}

//End
//wcckillall
if(cmd.getName().equalsIgnoreCase("wcckillall")){
if(p != null){
if(p.hasPermission("wecoschatcommands.wcckillall"));
       for (Player players : Bukkit.getOnlinePlayers()){
       players.sendMessage(ChatColor.GREEN + "[WecosChatCommands:] " + ChatColor.YELLOW + p.getDisplayName() + " killed everyone.");
players.setHealth(0.0);
return true;
}
}
}

//End


return false;
}

}

Phredd's IRC Twitch chat bot

### Phredd's IRC Twitch chat bot

import socket #imports module allowing connection to IRC
import threading #imports module allowing timing functions

#sets variables for connection to twitch chat
bot_owner = 'Phredd_'
nick = 'PhreddBot'
channel = '#oddmast'
server = 'phreddbot.jtvirc.com'
password = 'xxx'

queue = 0 #sets variable for anti-spam queue functionality

#sets variables for !add and !news commands
command = '!notset'
cmdmsg = 'This command is not set yet'
newsmsg = 'No news set'


irc = socket.socket()
irc.connect((server, 6667)) #connects to the server

#sends variables for connection to twitch chat
irc.send('PASS ' + password + '\r\n')
irc.send('USER ' + nick + ' 0 * :' + bot_owner + '\r\n')
irc.send('NICK ' + nick + '\r\n')
irc.send('JOIN ' + channel + '\r\n')

def queuetimer(): #function for resetting the queue every 30 seconds
    global queue
    print 'queue reset'
    queue = 0
    threading.Timer(30,queuetimer).start()
queuetimer()

while True:
   
    def message(msg): #function for sending messages to the IRC chat
        global queue
        queue = queue + 1
        print queue
        if queue < 20: #ensures does not send >20 msgs per 30 seconds.
            irc.send('PRIVMSG ' + channel + ' :' + msg + '\r\n')
        else:
            print 'Message deleted'
           
    def newstimer(): #function for announcing news every 3 minutes
        global newsmsg
        global ntimer
        themessage = '[NEWS]: ' + newsmsg
        message(themessage)
        print 'news on'
        ntimer = threading.Timer(180,newstimer)
        ntimer.start()
        if newsmsg == 'No news set': #stops announcing news if it has been canceled.
            ntimer.cancel()
        else:
            pass
   
    data = irc.recv(1204) #gets output from IRC server
    user = data.split(':')[1]
    user = user.split('!')[0] #determines the sender of the messages
    print data
   
    if data.find('PING') != -1:
        irc.send(data.replace('PING', 'PONG')) #responds to PINGS from the server
   
    if data.find('!test') != -1: #!test command
        message('Phredd_ is awesome! :D')      
    if data.find('!hello') != -1: #!hello command
        if user == 'phredd_':
            mymessage = 'Hi, ' + user + ', you are awesome! :D'
            message(mymessage)
        else:
            mymessage = 'Hi, ' + user + ', you are a Butt! :D'
            message(mymessage)
           
    if data.find('!cmd') != -1 and user == 'phredd_': #adds a new command
        addsplit = channel + ' :' + '!cmd'
        command = '!' + data.split(addsplit)[1].split(' ')[1] #determines new command
        cmdmsg = ' '.join(data.split(addsplit)[1].split(' ')[2:]) #determines command output
        message('Command set!')      
    if data.find(command) != -1: #responds to the new command with the output
        message(cmdmsg)
    if data.find('!delcmd') != -1 and user == 'phredd_': #!deladd command
        command = '!notset'
        cmdmsg = 'This command is not set yet'
        message('Command deleted!')
       
    if data.find('!addnews') != -1 and user == 'phredd_': #!addnews command
        newssplit = channel + ' :' + '!addnews'
        newsmsg = ' '.join(data.split(newssplit)[1].split(' ')[1:]) #determines new news message
        message('News set!')
        newstimer() #starts news timer function    
    if data.find('!news') != -1 and user == 'phredd_': #!news command
        themessage = '[NEWS]: ' + newsmsg
        message(themessage)
    if data.find('!delnews') !=-1 and user == 'phredd_': #deletes the news
        newsmsg = 'No news set'
        message('News deleted!')
        newstimer()
       
    elif data.split(' ')[1] == 'PRIVMSG' and data.split(':')[2].startswith(nick):
        message('Who said my name? SwiftRage')

Computercraft Chat to Speech script

Little script to pull server chat messages and speak them using misc.preipherals speaker and chatbox
Chatbox on left, Speaker on right

--TODO: Compile a table of all networked speakers to cycle through to allow sound reproduction over a larger area
--TODO: Signed server chat to command execution

local chatMsg = ""
local chatBox = peripheral.wrap("left")
local speaker = peripheral.wrap("right")

function getChat()
eventTyp, chatPlr, chatMsg = os.pullEvent("chat")
end

function sayChat()
speaker.speak(chatMsg,0)
end

--Main loop
while true do
getChat()
sayChat()
end