Code Monkey home page Code Monkey logo

sourcequerybot's Introduction

Not being maintained until I have more time. I'll be making some massive changes once I have time.

GitHub issues GitHub license Actions Status

Smart Presence Requires python 3.7 or higher!

About

This discord bot can edit multiple messages for multiple source servers containing game details, e.g. player count, map and server name. This allows you to create separate messages for different gamemodes etc.

Status: Stable

Index

Setup

  • pip3 install SourceQueryBot
  • Create a file like run.py & enter your bot token.
  • Run run.py using pm2 or screen!

Languages

  • English (Default) - SourceQueryBot.translations.English
  • Russian - SourceQueryBot.translations.Russian
  • Chinese - SourceQueryBot.translations.Chinese

API

  • from SourceQueryBot import SourceQueryBot

    Pass any discord bot client args / parameters.
    
    Parameters
    ----------
    catagories: list
        List of category objects.
    language: TranslationBase
        Defaults to english, pass it any language class.
    messages: Messages
        Handles message caching.
    smart_presence: bool
        Defaults to false, if enabled presence will rotate between maps.
    
  • from SourceQueryBot.settings import Category

    Handles server commands.
    
    Parameters
    ----------
    name: str
        Name of category
    server_name_limit: int
        Limits how many characters the server name can be.
    channel: int
        Discord channel ID for this category.
    color: hex
        Hex color code.
    servers: list
        List of Server objects.
    inline: bool
        Defaults to false, if servers should be inline.
    
  • from SourceQueryBot.settings import Server

    Handles server settings.
    
    Parameters
    ----------
    ip: str
        IP address of server.
    port: int
        Port of server, defaults to 27015.
    alt_name: str
        Optionally set a name what will overwrite the servers name.
    

Preview

Server List

Preview

Smart Presence

Updates the bot's presence every 10 seconds to a different server.

Smart Presence

Normal Presence

Displays total server stats.

Normal Presence

sourcequerybot's People

Contributors

blueberryy avatar blueskyclouds avatar wardpearce 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

Watchers

 avatar  avatar  avatar  avatar  avatar

sourcequerybot's Issues

Can u help Bot works for 30 min and crash

===========================================
Name: CsGo Server List#9661
Community: DistrictNine.Host
Discord.py version: 1.2.3
Source query rewrite version: 3.0.0

Task exception was never retrieved
future: <Task finished coro=<query_loop() done, defined at run.py:25> exception=RuntimeError('Session is closed',)>
Traceback (most recent call last):
File "run.py", line 37, in query_loop
async with session.get("https://districtnine.host/api/serverquery/?ip={}".format(values["server-ips"])) as r:
File "/usr/local/lib/python3.6/site-packages/aiohttp/client.py", line 1005, in aenter
self._resp = await self._coro
File "/usr/local/lib/python3.6/site-packages/aiohttp/client.py", line 348, in _request
raise RuntimeError('Session is closed')
RuntimeError: Session is closed

Error

Any help?

File "run.py", line 1, in <module> from SourceQueryBot import SourceQueryBot File "/root/Tessste/SourceQueryBot/__init__.py", line 26 def __init__(self, catagories: list, ^ SyntaxError: invalid syntax

new error

Hello sorry for the inconvenience, I fixed the previous error that was throwing me, but now it throws me a new error that makes the bot not work (The query or the presence does not work) the bot only stays on.
Error

new problem

Traceback (most recent call last):
File "run.py", line 36, in query_loop
async with aiohttp_session.get("https://districtnine.host/api/serverquery/?ip={}".format(values["server-ips"])) as r:
File "/usr/local/lib/python3.6/site-packages/aiohttp/client.py", line 1005, in aenter
self._resp = await self._coro
File "/usr/local/lib/python3.6/site-packages/aiohttp/client.py", line 476, in _request
timeout=real_timeout
File "/usr/local/lib/python3.6/site-packages/aiohttp/connector.py", line 522, in connect
proto = await self._create_connection(req, traces, timeout)
File "/usr/local/lib/python3.6/site-packages/aiohttp/connector.py", line 854, in _create_connection
req, traces, timeout)
File "/usr/local/lib/python3.6/site-packages/aiohttp/connector.py", line 959, in _create_direct_connection
raise ClientConnectorError(req.connection_key, exc) from exc
aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host districtnine.host:443 ssl:None [No address associated with hostname]
Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x7fae7faeaba8>

Old Message Deletions

When the bit restarts, the old messages remain. Would be good for it to delete the old messages however do not delete all messages in the channel as we use it in our information channel.

bot gets problme after a certain time

===========================================
Name: Csgo-Bot#8026
Community: DistrictNine.Host
Discord.py version: 1.2.3
Source query rewrite version: 2.0.0

Task exception was never retrieved
future: <Task finished coro=<background_task() done, defined at /home/administrator/discordbots/Discord-Server-List-master/server-list.py:27> exception=ServerDisconnectedError(None,)>
Traceback (most recent call last):
File "/home/administrator/discordbots/Discord-Server-List-master/server-list.py", line 37, in background_task
async with session.get("http://districtnine.host/api/serverquery/?ip={}".format(values["server-ips"])) as r:
File "/usr/local/lib/python3.6/site-packages/aiohttp/client.py", line 1005, in aenter
self._resp = await self._coro
File "/usr/local/lib/python3.6/site-packages/aiohttp/client.py", line 497, in _request
await resp.start(conn)
File "/usr/local/lib/python3.6/site-packages/aiohttp/client_reqrep.py", line 844, in start
message, payload = await self._protocol.read() # type: ignore # noqa
File "/usr/local/lib/python3.6/site-packages/aiohttp/streams.py", line 588, in read
await self._waiter
aiohttp.client_exceptions.ServerDisconnectedError: None

the bot does not work for me

Hi, the bot throws me this error on heroku 2020-08-19T21: 11: 26.094454 + 00: 00 app [worker.1]: [WARNING]: 'ServerModel' object is not subscriptable and does not show the discord presence.

In pc throws me this error: Please wait I'm closing.
Traceback (most recent call last):
File "run.py", line 5, in
client.run("token")
File "D:\Usuario\Desktop\Programas\lib\site-packages\discord\client.py", line 640, in run
return future.result()
File "D:\Usuario\Desktop\Programas\lib\site-packages\discord\client.py", line 621, in runner
await self.start(*args, **kwargs)
File "D:\Usuario\Desktop\Programas\lib\site-packages\discord\client.py", line 585, in start
await self.connect(reconnect=reconnect)
File "D:\Usuario\Desktop\Programas\lib\site-packages\discord\client.py", line 499, in connect
await self._connect()
File "D:\Usuario\Desktop\Programas\lib\site-packages\discord\client.py", line 463, in _connect
await self.ws.poll_event()
File "D:\Usuario\Desktop\Programas\lib\site-packages\discord\gateway.py", line 471, in poll_event
await self.received_message(msg)
File "D:\Usuario\Desktop\Programas\lib\site-packages\discord\gateway.py", line 425, in received_message
func(data)
File "D:\Usuario\Desktop\Programas\lib\site-packages\discord\state.py", line 750, in parse_guild_create
guild = self._get_create_guild(data)
File "D:\Usuario\Desktop\Programas\lib\site-packages\discord\state.py", line 725, in _get_create_guild
guild._from_data(data)
File "D:\Usuario\Desktop\Programas\lib\site-packages\discord\guild.py", line 297, in _from_data
self._sync(guild)
File "D:\Usuario\Desktop\Programas\lib\site-packages\discord\guild.py", line 324, in _sync
self._add_channel(TextChannel(guild=self, data=c, state=self._state))
File "D:\Usuario\Desktop\Programas\lib\site-packages\discord\channel.py", line 107, in init
self._update(guild, data)
File "D:\Usuario\Desktop\Programas\lib\site-packages\discord\channel.py", line 131, in _update
self._fill_overwrites(data)
File "D:\Usuario\Desktop\Programas\lib\site-packages\discord\abc.py", line 294, in _fill_overwrites
self._overwrites.append(_Overwrites(id=overridden_id, **overridden))
TypeError: new() got an unexpected keyword argument 'deny_new'

The errors started from nowhere :/, I use the bot for my game server community, I tried the updated version and it doesn't work either.

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.