Giter Club home page Giter Club logo

minqlbot's People

Contributors

minomino avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

minqlbot's Issues

!silence doesn't work

!silence mutes a player but doesn't unmute it when the time expires. Also, if I try to use !unsilence it doesn't work neither.

Bot unload when server gets down

Recently 'server host' server went down with all game servers. Bot unload following this event, and therefore autoconnect plugin couldn't work (and join specified person as fallover after reconnect)

self.switch not reliable

I noticed that sometimes during balance, sb that was being switched is left on spec.
Probably QL loosing packets. Maybe switch should perform some final check to assure proper switching even if some command is lost on its way to server?

Auto Mute

I added a plugin called mute.py and put it in the config.cfg plugin list. I can get most of the stuff to work but I can't get the bot to execute the auto mute on player connect. Here is the contents of the mute.py file:


import minqlbot
import time

class mute(minqlbot.Plugin):
def init(self):
super().init()
self.add_hook("player_connect", self.handle_player_connect, minqlbot.PRI_NORMAL)
self.add_command("mute", self.cmd_mute, 1, usage="")
self.add_command("unmute", self.cmd_unmute, 1, usage="")
self.add_command("addmute", self.cmd_addmute, 2)
self.add_command("delmute", self.cmd_delmute, 2)

    #self.mute_timer = None

def handle_player_connect(self, player):
    self.delay(5, self.check_mute(player))

def cmd_mute(self, player, msg, channel):
    if len(msg) < 2:
        return minqlbot.RET_USAGE

    n = self.find_player(msg[1])
    if n:
        self.mute(n)
    else:
        channel.reply("^7I do not know '{}'.".format(msg[1]))

def cmd_unmute(self, player, msg, channel):
    if len(msg) < 2:
        return minqlbot.RET_USAGE

    n = self.find_player(msg[1])
    if n:
        self.unmute(n)
    else:
        channel.reply("^7I do not know '{}'.".format(msg[1]))

def cmd_addmute(self, player, msg, channel):
    if len(msg) < 1:
        return
    name = msg[1].lower()
    #Permission level 5 players not auto mutable
    if self.has_permission(name, 5):
        channel.reply("^6{}^7 has permission level 5 and cannot be auto muted.".format(name))
        return
    else:
        c = self.db_query("SELECT * FROM Mutes WHERE name=?", name)
        if not c.fetchone():
            self.db_query("INSERT INTO Mutes VALUES(?, 0, 0, 0, 0)", name)
            self.db_commit()
        self.db_query("UPDATE Mutes SET active=1 WHERE name=?", name)
        self.db_commit()
        channel.reply("^6{} ^7has been added to the Auto Mute list.".format(name))
        n = self.find_player(msg[1])
        if n:
            self.mute(n)


def cmd_delmute(self, player, msg, channel):
    if len(msg) < 1:
        return
    else:
        name = msg[1].lower()
        c = self.db_query("SELECT * FROM Mutes WHERE name=?", name)
        delmute = False
        for row in c:
            if row[1]: # if active Mute
                self.db_query("UPDATE Mutes SET active=0 WHERE name=? AND issued=?", row[0], row[2])
                self.db_commit()
                delmute = True
        if delmute:
            channel.reply("^6{}^7 has been removed form the auto mute list.".format(name))
            n = self.find_player(msg[1])
            if n:
                self.unmute(n)
        else:
            channel.reply("^7No active auto mutes on ^6{}^7 found.".format(name))

def check_mute(self, player, channel):
    channel.reply("Start")
    config = minqlbot.get_config()
    channel.reply("0")
    if "Mute" in config and "AutoMute" in config["Mute"]:
        auto_pass = config["Mute"].getboolean("AutoMute")
        channel.reply("1")
        if auto_pass:
            channel.reply("2")
            name = self.clean_name(player).lower()
            c = self.db_query("SELECT * FROM Mutes WHERE name=?", name)
            for row in c:
                if name == row["name"] and row["active"]:
                    channel.reply("3")
                    self.mute(name)
                    channel.reply("^6{}^7 has been muted. Msg BarelyMiSSeD or xXThatDudeXx if this is in error.".format(player))      

The addmute and delmute seem to be working but when a player connects nothing happens. I put the commands "channel.reply("1")" and the ones like it in to see where it was getting in the code, but I am not seeing any messages at all when a player in the mutes database is added, not even the "Start" message. Any ideas?

bot permission

i have set up the bot, one on standalone and one on steam btw,,, anyway in either case my bot have permission level 0, obviously with admin or referee status,,any help?

Deal with ambiguous usage of Plugin.find_player()

From IRC:

<Thaya> you know those times when you use like a shortcut of someones name for a cmd
<Thaya> and theres a dude with the exact same first letters in name
<Thaya> so you end up doing something completely different sometimes
<Thaya> it should actually just cancel the command when this happens
<Thaya> and maybe throw a message like "there's two players whos names start with 'abc'"
<Thaya> it doesn't happen a lot but it's annoying as FUCK if it does
<Thaya> you can ruin rounds + cause global confusion etc
<Thaya> so worth fixing imo

Adding commands

Is there a limit to the amount of commands that can be added, or a naming convention that can't be used?
I tried adding a command in essentials.py like so:
self.add_command("protect", self.cmd_protect, 4, usage="<full_name>")

def cmd_protect(self, player, msg):
if len(msg) < 2:
return minqlbot.RET_USAGE

but if doesn't work when I say !protect in quake live. Any ideas?

Failed to inject

I am running Windows 7 Professional 64 bit. I installed the 32 bit versions of python and Visual C++ and I keep getting 'failed to inject' when I try to run Minjection.exe. I ran Dependency Walker and the only thing that shows as RED is the CPU (x64 in red) on the system dll files. This is a fresh installation of windows on a pc that I run Teamspeak and Murmur voice servers.

Any ideas what I need to do next? I would love to try out the server bot.

IRC

The bot will time out in IRC at times. I don't know why, but is there a way to get the bot to reconnect to IRC without restarting Quake Live?

Vote Passing

I would like to use the vote passing feature, but it is currently set to pass a vote if the majority votes yes. I would like to be able to set that value to something like 75% and to turn not use the auto pass if it is a map vote outside of warm-up.

I was looking through the python files and I found the start of the process in the essentials.py file. Do you have something like this in the works? Or is it something I an easily edit?

Thanks

Friendlist and friend communication support

  1. ability to check which bot friends are online
  2. ability to send them messages
  3. ability to parse their messages

probably doable with extraql but would be much cleaner if builtin

could write plugin that for subscribed ppl could for example announce new matches (players .. waiting etc.) or similar.

invites don't work that well as they are not displayed in-game. Sometimes ppl want me to let them know when they could join.

I can't modify minqlbot.dll

If I try to modify a single character of the minqlbot.dll and then I try to inject it says "Failed to inject". I thought I hadn't some dependencies but everything was ok. How is it possible? And how can I modify the minqlbot.dll without breaking it?

Move functionality to python layer

Probably it would be best to move almost everything that can be moved from minqlbot to minqlbot-plugins. It would make development easier and minqlbot 'core' could be improved and made less complex, more stable and reliable.

Possible switch to a client-server NoSQL database

Just thought I'd put this as a sort of warning, if you will. It's very likely I'll switch to a client-server NoSQL database when the Steam exclusive update hits. Why? Primarily for the following reasons:

  • Being able to run multiple servers using the same database. Obviously that would work with any client-server SQL database too, but see below.
  • Dynamic schemas. It's just so much nicer to be able to change schemas on the fly. This is why I'm leaning towards NoSQL and not just MySQL or something like that.
  • The data in the current SQLite databases will be useless due nicknames not being unique identifiers, making this the perfect opportunity to make this change.
  • NoSQL tends to fall short when it comes to complex queries. The bot uses extremely simple queries, so that's not an issue either.
  • I've been looking into ways to reduce both CPU and GPU load of QL to make it more viable to run multiple clients without having it hog resources unneccesarily on bot users who don't use it to play on, and I've had some success doing so, so that's even more reason to have a client-server database.

At the time of writing, I'm leaning towards MongoDB, as I've worked with it before, has a first-party Python driver and has good documentation.

Player class should be able to represent arbitrary player not necessarily present

it raises exception:
except NonexistentPlayerError:
self.__invalidate("Tried to initialize a Player instance of a nonexistant player.")

but its needed to represent player that is not on server, for future-proof implementations for example all functions should pass Player instances instead of names. Behind the scenes, in methods like 'getelo' player instance could be used of the player that exists but is not necessarily on server and whose lets say steam id was found in some other way.

Fun.py

I am trying to get a random response from the bot when someone types the bot's name (other). I edited the code in the fun.py but I can't get it to work. Any ideas? Here is the code from the file:

import minqlbot

import random

class fun(minqlbot.Plugin):
def init(self):
self.add_command("cookies", self.cmd_cookies)
self.add_command("<3", self.cmd_heart, channels=("chat", "team_chat", "tell"))
self.add_command("stfu", self.cmd_stfu)
self.add_command("other", self.cmd_other)
self.add_command("flowers", self.cmd_flowers)
self.add_command("lies", self.cmd_lies)
self.add_command("foc", self.cmd_foc)

def cmd_cookies(self, player, msg, channel):
    channel.reply("^7For me? Thank you, {}!".format(player))

def cmd_heart(self, player, msg, channel):
    s = ("^1\r oo   oo"
         "\no  o o  o"
         "\no   o   o"
         "\n o     o"
         "\n  o   o"
         "\n   o o"
         "\n    o")
    channel.reply(s.replace("o", "\x08"))

def cmd_stfu(self, player, msg, channel):
    channel.reply("^1Fuck You ^2{}^1! ^7You can't stop my ^4POWER^1!!".format(player))

def cmd_other(self, player, msg, channel):
    fo = open("other.txt","r")
    ln = sum(1 for line in fo)
    sl = random.randrange(1, ln + 1)
    fo.close()
    global othertext
    othertext = open("other.txt","r").readline(sl)
    channel.reply(othertext.format(player))
    #othertext.close()

def cmd_flowers(self, player, msg, channel):
    channel.reply("^7Awww, ^1Flowers ^7are so thoughtful {}^7. Still no sex for you!".format(player))

def cmd_lies(self, player, msg, channel):
    channel.reply("^1LIES?!? ^7Who is full of lies? {} ^7You should kick the liar!".format(player))

def cmd_foc(self, player, msg, channel):
    channel.reply("^1F^7.O.^4C^7 The ^1BEST^7 clan in the ^2World^1!^7!^4!".format(player))

The part that doesn't work is the cmd_other. I worked in the python IDLE command line and I was able to verify that I can read a random line from a file using the code I have in that command, but it doesn't work when I put the code in here. Does it have something to do with "channel.reply(othertext.format(player))"?

Here is a sample line from the other.txt file:
^7I am just a bot {}^7. I can’t give your life meaning!!

Can you somehow run this alongside your normal Quake Live?

I'd like to run both a server bot and my normal client, is this somehow possible? I've tried to copy the relevant files into a new directory (including all the .pk3s), but when I try to launch the game it tells me that I cannot run quakelive.exe directly and need to run the launcher.

I could fire up a Virtual Machine, but this seems kind of excessive just for the server management.

Feature request: Make it possible to make a Top X (Ranking based server)

A feature to make a TOP 500 Ca server would be nice. With elo encreasing all the time, you have to adjust elo higher, when players get higher elos. Making a rank/top feature, you would not have to care about elo changing.

Shouldn't be too hard to implement, since the bot already knows your rank.

\dropflag, \droppowerup, etc. being delayed.

From #minqlbot on Quakenet.

<quaker_oats> Is it normal for example my binds for \dropflag and \droppowerup to be delayed if minqlbot is active ?
<@mitch> Yes
<quaker_oats> Any way to remedy?
<@mitch> No, it's how the bot works :> Mino can explain it better than I can off the top of my head
<@Mino> Oh wow, I had no idea those commands were passed through the text channel.
<quaker_oats> Ah
<@Mino> That's kinda dumb.
<quaker_oats> ?
<@Mino> Basically there are two channels, one is text-based and has stuff like team changes, chat, getting scores, and so on. The other one has stuff like players' movement, shooting, jumping, etc.
<@Mino> And it's unexpected to hear that dropflag and such isn't taken care of by the latter.
<@Mino> The bot has a queue system for the former channel to avoid having the bot and the user execute commands more or less at the same time, because the server will simply ignore one of them if you do so.
<quaker_oats> My bind for "\team s" is delayed a split second also in case you're wondering anything like that
<@Mino> So if dropflag is one of the delayed ones, it means that if you were to press dropflag and a chat bind more or less at the same time, only one will go through.
<quaker_oats> And also "\team r" and "\team b"
<@Mino> Which is pretty dumb, in my opinion.
<@mitch> Off the top of my head, I would guess it's to stop spam
<@mitch> Seeing as you get the announcer with and flag interactions
<@Mino> Ah
<@mitch> Same reason I would guess they made /say etc. not be able to be used repeatedly at the same time
<quaker_oats> "get the announcer with"?
<@mitch> any*
<@mitch> The announcer shouts stuff on flag interactions
<@mitch> voice over, w/e
<quaker_oats> oh
<@Mino> Well, I could modify the queue system to push dropflag first in queue. Can't think of a better solution.
<@Mino> The other solution would be to bypass the queue system, but that could make the bot drop messages or commands.
<@Mino> or have dropflag be dropped if someone was to do something like !teams right before
<@Mino> so the first solution sounds like the best to me

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.