Giter Club home page Giter Club logo

tc-telegram-bot's Introduction

TC-Telegram-Bot

This is a Telegram bot that execute commands in TrinityCore or AzerothCore console via telnet.

If you don't know how to set up a basic Telegram Bot, read this first: https://core.telegram.org/bots and talk with @BotFather

NOTE: this repo is not mantained anymore, use this new Telegram bot!, it's based on PHP and SOAP, made by @MasterKing32.

Installing

To run this bot you need the python-telegram-bot library, you can install it by

pip install python-telegram-bot

To install it from source you can download it from https://github.com/leandrotoledo/python-telegram-bot

Configuration

After installing the client you must configure it settings the following parameters:

HOST = "127.0.0.1"	#IP of the server
port = 3443		#Port of the server
username = ""		#Username telnet access 
password = ""		#Password telnet access
logs = 1			#Enable/Disable logs (1/0)

TOKEN = ""		#Token of your telegram bot that you created from @BotFather

The last parameter it's the Token of your bot that you receive while creating it with @BotFather (ask this bot on telegram).

After configuration you can run your bot, remind to enable telnet in etc/worldserver.conf (RA.* settings) and open your worldserver.

Security

You can add a condition filter to this line that active the bot only with your chat throught the chat_id:

https://github.com/Helias/TC-Telegram-Bot/blob/master/telegrambot.py#L72

just adding "and chat_id == your_chat_id".

What is chat_id? Anyone on Telegram has a chat_id which any bot use to recognize you and send a message.

How can I find my chat_id? You can obtain your chat id just sending /chatid to @GiveChatId_Bot.

(if you want to obtain the chatid of a group you must invite @GiveChatId_Bot to the group and write /chatid, the chat_id of the gorup usually are negative).

Usages

Here the commands that are actually supported:

/saveall 
/serverinfo - show server info
/ticket list - show ticket list
/ticket onlinelist - show ticket onlinelist
/ticket viewid {ID}
/ticket complete {ID} {Reason}
/mute {PlayerName} {minutes} {reason}
/mutehistory {accountName}
/unmute {PlayerName}
/gmannounce {testo}
/announce {testo}
/tele {PlayerName} {Area}
/reload {table}
/revive {PlayerName}
/pinfo {PlayerName}
/kick {PlayerName}
/unstuck {PlayerName}
/baninfo ip/account/character {ip/accountName/playerName}

Examples:

Example1

Example2

FAQ

(the follow error should be fixed from this commit https://github.com/Helias/TC-Telegram-Bot/commit/023cc54b262afd644f1ac362c91e9c88f0a9dced )

My bot doesn't run and return the follow error:

    LAST_UPDATE_ID = bot.getUpdates()[-1].update_id
IndexError: list index out of range

Send a message to your Bot and (re)run the file telegrambot.py.

Contribute

You can help me opening a new issue to report a bug or a suggestion

or you can donate to support me

Donate

tc-telegram-bot's People

Contributors

augustozanellato avatar helias avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

tc-telegram-bot's Issues

Broken Pipe

Traceback (most recent call last):
File "telegrambot.py", line 80, in
messageText = command(".server info", 1)
File "telegrambot.py", line 23, in command
tn.write("exit" + "\r\n")
File "/usr/lib/python2.7/telnetlib.py", line 283, in write
self.sock.sendall(buffer)
File "/usr/lib/python2.7/socket.py", line 228, in meth
return getattr(self._sock,name)(*args)
socket.error: [Errno 32] Broken pipe

Error when doing many commands

I have another error when I use two times /tele player location

Traceback (most recent call last):
File "/root/SyndicateBot/telegrambot.py", line 68, in
text = update.message.text
AttributeError: 'NoneType' object has no attribute 'text'

Bot freezed

Hello,
After sending one command the bot is not responding to any command:
/help
/serverinfo

If I restart the python script the command is runned and freeze again until next restart

Break after ctrl c:
http://pastebin.com/vKCy5FwN

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.