Guest User

Untitled

a guest
Oct 19th, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.79 KB | None | 0 0
  1. import sys
  2. import socket
  3. import string
  4.  
  5. HOST='irc.esper.net'
  6. PORT=6667
  7. NICK='MBot'
  8. IDENT='mufinbot'
  9. REALNAME='MufinBot'
  10. channellist=['#RelicTest','#RelicCraft','#BeastNode']
  11. readbuffer=''
  12.  
  13. continueloop=1
  14. zombiemode=0
  15. zombieplayer=''
  16. zombiechannel=''
  17.  
  18. searchPhrases=['(id?)']
  19.  
  20. blockitemDB=[["Air","0"],["Stone","1","Smoothstone"],["Grass","2"],["Dirt","3"],["Cobblestone","4"],["WoodenPlanks","5"],["Sapling","6"],["Sapling","6-1"],["Sapling","6-2"],["Bedrock","7"],["Water","8"],["Water","9"],["Lava","10"],["Lava","11"],["Sand","12"],["Gravel","13"],["GoldOre","14"],["IronOre","15"],["CoalOre","16"],["Wood","17"],["Wood","17-1"],["Wood","17-2"],["Leaves","18"],["Leaves","18-1"],["Sponge","19"],["Glass","20"],["LapisLazuliOre","21"],["LapisLazuliBlock","22"],["Dispenser","23"],["Sandstone","24"],["NoteBlock","25"],["Bed","26"],["PoweredRail","27"],["DetectorRail","28"],["StickyPiston","29"],["Cobweb","30"],["Unnamed","31"],["Unnamed","32"],["Piston","33"],["Unnamed","34"],["Wool","35"],["OrangeWool","35-1"],["MagentaWool","35-2"],["LightBlueWool","35-3"],["YellowWool","35-4"],["LimeWool","35-5"],["PinkWool","35-6"],["GrayWool","35-7"],["LightGrayWool","35-8"],["CyanWool","35-9"],["PurpleWool","35-10"],["BlueWool","35-11"],["BrownWool","35-12"],["GreenWool","35-13"],["RedWool","35-14"],["BlackWool","35-15"],["Unnamed","36"],["Flower","37"],["Rose","38"],["Mushroom","39"],["Mushroom","40"],["BlockofGold","41"],["BlockofIron","42"],["Unnamed","43"],["StoneSlab","44"],["SandstoneSlab","44"],["WoodenSlab","44"],["StoneSlab","44"],["Bricks","45"],["TNT","46"],["Bookshelf","47"],["MossStone","48"],["Obsidian","49"],["Torch","50"],["Fire","51"],["MonsterSpawner","52"],["WoodenStairs","53"],["Chest","54"],["RedstoneDust","55"],["DiamondOre","56"],["BlockofDiamond","57"],["CraftingTable","58"],["Crops","59"],["Farmland","60"],["Furnace","61"],["Furnace","62"],["Sign","63"],["WoodenDoor","64"],["Ladder","65"],["Rail","66"],["StoneStairs","67"],["Sign","68"],["Lever","69"],["PressurePlate","70"],["IronDoor","71"],["PressurePlate","72"],["RedstoneOre","73"],["RedstoneOre","74"],["RedstoneTorch","75"],["RedstoneTorch","76"],["Button","77"],["Snow","78"],["Ice","79"],["Snow","80"],["Cactus","81"],["Clay","82"],["Sugarcane","83"],["Jukebox","84"],["Fence","85"],["Pumpkin","86"],["Netherrack","87"],["SoulSand","88"],["Glowstone","89"],["Portal","90"],["Jack'o'Lantern","91"],["Cake","92"],["Unnamed","93"],["Unnamed","94"],["Lockedchest","95"],["Trapdoor","96"],["IronShovel","256"],["IronPickaxe","257"],["IronAxe","258"],["FlintandSteel","259"],["Apple","260"],["Bow","261"],["Arrow","262"],["Coal","263"],["Charcoal","263-1"],["Diamond","264"],["IronIngot","265"],["GoldIngot","266"],["IronSword","267"],["WoodenSword","268"],["WoodenShovel","269"],["WoodenPickaxe","270"],["WoodenAxe","271"],["StoneSword","272"],["StoneShovel","273"],["StonePickaxe","274"],["StoneAxe","275"],["DiamondSword","276"],["DiamondShovel","277"],["DiamondPickaxe","278"],["DiamondAxe","279"],["Stick","280"],["Bowl","281"],["MushroomStew","282"],["GoldenSword","283"],["GoldenShovel","284"],["GoldenPickaxe","285"],["GoldenAxe","286"],["String","287"],["Feather","288"],["Gunpowder","289"],["WoodenHoe","290"],["StoneHoe","291"],["IronHoe","292"],["DiamondHoe","293"],["GoldenHoe","294"],["Seeds","295"],["Wheat","296"],["Bread","297"],["LeatherCap","298"],["LeatherTunic","299"],["LeatherPants","300"],["LeatherBoots","301"],["ChainHelmet","302"],["ChainChestplate","303"],["ChainLeggings","304"],["ChainBoots","305"],["IronHelmet","306"],["IronChestplate","307"],["IronLeggings","308"],["IronBoots","309"],["DiamondHelmet","310"],["DiamondChestplate","311"],["DiamondLeggings","312"],["DiamondBoots","313"],["GoldenHelmet","314"],["GoldenChestplate","315"],["GoldenLeggings","316"],["Goldenboots","317"],["Flint","318"],["RawPorkchop","319"],["CookedPorkchop","320"],["Painting","321"],["GoldenApple","322"],["Sign","323"],["WoodenDoor","324"],["Bucket","325"],["WaterBucket","326"],["Lavabucket","327"],["Minecart","328"],["Saddle","329"],["IronDoor","330"],["Redstone","331"],["Snowball","332"],["Boat","333"],["Leather","334"],["Milk","335"],["Brick","336"],["Clay","337"],["SugarCanes","338"],["Paper","339"],["Book","340"],["Slimeball","341"],["MinecartwithChest","342"],["MinecartwithFurnace","343"],["Egg","344"],["Compass","345"],["FishingRod","346"],["Clock","347"],["GlowstoneDust","348"],["RawFish","349"],["CookedFish","350"],["InkSac","351"],["RoseRed","351-1"],["CactusGreen","351-2"],["CocoaBeans","351-3"],["LapisLazuli","351-4"],["PurpleDye","351-5"],["CyanDye","351-6"],["LightGrayDye","351-7"],["GrayDye","351-8"],["PinkDye","351-9"],["LimeDye","351-10"],["DandelionYellow","351-11"],["LightBlueDye","351-12"],["MagentaDye","351-13"],["OrangeDye","351-14"],["Bonemeal","351-15"],["Bone","352"],["Sugar","353"],["Cake","354"],["Bed","355"],["RedstoneRepeater","356"],["Cookie","357"],["Map","358"],["Shears","359"],["MusicDisc","2256"],["MusicDisc","2257"]]
  21.  
  22. s=socket.socket( )
  23. s.connect((HOST, PORT))
  24. s.send('NICK %s\r\n' % NICK)
  25. s.send('USER %s %s bla :%s\r\n' % (IDENT, HOST, REALNAME))
  26.  
  27. while continueloop:
  28. readbuffer=readbuffer+s.recv(1024)
  29. temp=string.split(readbuffer, '\n')
  30. readbuffer=temp.pop( )
  31.  
  32. for loop in range(len(temp)):
  33. print temp[loop]
  34.  
  35. for line in temp:
  36. line=string.rstrip(line)
  37. line=string.split(line)
  38.  
  39. if(line[0]=='PING'):
  40. s.send('PONG %s\r\n' % line[1])
  41.  
  42. if(line[0]=='ERROR'):
  43. continueloop=0
  44. s.send('QUIT')
  45. if(line==[':'+NICK,'MODE',NICK,':+i']):
  46. for channellistloop in channellist:
  47. s.send('JOIN %s\r\n' % channellistloop)
  48. s.send('PRIVMSG %s :%s Reporting for duty, sir!\r\n' % (channellistloop, NICK))
  49. if(line[1]=='PRIVMSG'):
  50. line[0],line[3]=line[0][1:string.find(line[0],'!')],line[3][1:]
  51. if(line[2][0:1]=='#'):
  52. if(zombiemode and line[0]!=NICK and line[2]==zombiechannel):
  53. s.send('PRIVMSG %s :%s\r\n' % (zombieplayer, line[0]+': '+string.join(line[3:])))
  54.  
  55. searchPhrasesCheck=-1
  56.  
  57. for searchPhrasesLoop in searchPhrases:
  58. if(-1==searchPhrasesCheck and searchPhrasesLoop in line[3:]):
  59. searchPhrasesCheck=line[3:].index(searchPhrasesLoop)
  60. if(0==searchPhrasesCheck):
  61. s.send("PRIVMSG %s :'%s' search phrase found.\r\n" % (line[2], searchPhrases[searchPhrasesCheck]))
  62.  
  63. if(0<searchPhrasesCheck):
  64. searchingFor=line[searchPhrasesCheck+2]
  65. found=[]
  66. for blockdbnumber in range(len(blockitemDB)):
  67. for blockdblist in blockitemDB[blockdbnumber]:
  68. if(string.lower(searchingFor)==string.lower(blockdblist)):
  69. found.append(blockdbnumber)
  70. if(len(found)):
  71. for foundlist in found:
  72. s.send("PRIVMSG %s :Official name: '%s' Data Value: %s\r\n" % (line[2], blockitemDB[foundlist][0], blockitemDB[foundlist][1]))
  73. else:
  74. s.send("PRIVMSG %s :Unknown block/item: '%s'\r\n" % (line[2], searchingFor))
  75. else:
  76. if(string.count(line[3],'zombiemode:167493258')):
  77. if(0==zombiemode or 1==zombiemode and '#'==line[4][0:1] and len(line[4])>=2):
  78. if('#'==line[4][0:1] or len(line[4])<2):
  79. zombiemode=1
  80. zombieplayer=line[0]
  81. zombiechannel=line[4]
  82. s.send('PRIVMSG %s :Zombie mode activated for user %s on channel %s\r\n' % (zombieplayer, zombieplayer, zombiechannel))
  83. if(not(line[4] in channellist)):
  84. s.send('JOIN %s\r\n' % zombiechannel)
  85. else:
  86. s.send('PRIVMSG %s :Invalid channel name.' % line[0])
  87. elif(line[0]==zombieplayer):
  88. s.send('PRIVMSG %s :Zombie mode deactivated.\r\n' % zombieplayer)
  89. zombiemode=0
  90. zombieplayer=''
  91. if(not(zombiechannel in channellist)):
  92. s.send('LEAVE %s\r\n' % zombiechannel)
  93. zombiechannel=''
  94. else:
  95. s.send('PRIVMSG %s :Zombie mode already active.\r\n' % line[0])
  96. else:
  97. if(zombiemode):
  98. s.send('PRIVMSG %s :%s\r\n' % (zombiechannel, string.join(line[3:])))
Add Comment
Please, Sign In to add comment