diff --git a/dist/ba_root/mods/features/discord_bot3.py b/dist/ba_root/mods/features/discord_bot3.py deleted file mode 100644 index a2f1e41..0000000 --- a/dist/ba_root/mods/features/discord_bot3.py +++ /dev/null @@ -1,2128 +0,0 @@ -# ADVANCED LOGGING BOT SYSTEM BY ROCKY AND VORTEXXXXXX -from re import A -import re -import discord, requests, asyncio ,ba, _ba, ba.internal, json, psutil, _thread -from threading import Thread -from discord.ext.commands import Bot -from ba._general import Call -from playersData import pdata -from serverData import serverdata -import setting -from tools import mongo -from tools import chatmessage as cm -from chatHandle.ChatCommands.commands import NormalCommands as nc -from chatHandle.ChatCommands.commands import CoinCmds as cc -from bacommon.servermanager import ServerConfig -from features import complaints as c -import members.members as mid -import datetime -from stats import mystats -import os -intents = discord.Intents().all() -client = Bot(command_prefix='v!', intents=intents) - -stats = {} -livestatsmsgs = [] -logsChannelID = 859519868838608970 -liveStatsChannelID = 1079019991694839818 -whitelisted_servers = 1168272029280112673 -whitelisted_users = 123456789012345678 -complaintChannelID= 1194188093461385226 -prefix = '' -commands_prefix = '' -liveChat = True -token = '' -logs = [] -current_directory = os.path.dirname(os.path.abspath(__file__)) -setting_json_path = os.path.join(current_directory, '..', 'setting.json') -BANK_PATH = _ba.env().get("python_directory_user", "") + "/bank.json" - - - -def push_log(msg): - global logs - logs.append(msg) - -def init(): - loop = asyncio.get_event_loop() - loop.create_task(client.start(token)) - Thread(target=loop.run_forever).start() - -def addcoins(accountid: str, amount: int): - if os.path.exists(BANK_PATH): - with open(BANK_PATH) as f: - bank = json.loads(f.read()) - else: - bank = {} - if accountid not in bank: - bank[accountid] = 0 - bank[accountid] += amount - with open(BANK_PATH, 'w') as f: - f.write(json.dumps(bank)) - if amount > 0: - print('Transaction successful') - -def removecoins(accountid: str, amount: int): - if os.path.exists(BANK_PATH): - with open(BANK_PATH) as f: - bank = json.loads(f.read()) - else: - bank = {} - if accountid not in bank: - bank[accountid] = 0 - bank[accountid] -= amount - with open(BANK_PATH, 'w') as f: - f.write(json.dumps(bank)) - if amount > 0: - print('Transaction successful') - -channel = None - -async def send_complaint_to_channel(server_name, time, myself, ign, useracid, fign, acid, linkedaccount, offender, complaint): - # Replace YOUR_COMPLAINTS_CHANNEL_ID with the actual ID of your complaints channel - # channel_id = 1079019994802827284 - channel = client.get_channel(complaintChannelID) - - if not channel: - print(f"Channel with ID {complaintChannelID} not found.") - return - - complaint_message = ( - f"{server_name}__\n=========================================**\n> |`PLAYER SIZE:` {len(stats['roster'])}/{ba.internal.get_public_party_max_size()}\n> \n> |`USERNAME(IGN)/ACCOUNT-ID:` {pbid}" - f"\n**=========================================**" - ) - await channel.send(complaint_message) - - -async def joined_player(pbid, devices_string, time): - # Replace YOUR_NOTIFY_CHANNEL_ID with the actual ID of your complaints channel - channel_id = 1201908867810730034 - channel = client.get_channel(channel_id) - otheraccounts = pdata.get_detailed_pinfo(pbid) - serverss = _ba.app.server._config.party_name - - if not channel: - print(f"Channel with ID {channel_id} not found.") - return - - message = ( - f"**__{serverss}__\n=========================================**\n> |`PLAYER JOINED TIME:` {time}\n> \n> |`PLAYER-NAME:` {devices_string}\n> \n" - f"> |`PLAYER ACCOUNT-ID:` {pbid}\n> \n> |`LINKED-ACCOUNTS OF PLAYER:` {otheraccounts}\n> \n> |**JOINED THE GAME**\n> __ __\n**=========================================**" - ) - await channel.send(message) - #print(f"{devices_string}... Notification send Successfully!") - -async def server_info(): - # Replace YOUR_COMPLAINTS_CHANNEL_ID with the actual ID of your complaints channel - channel_id = 1194188093461385226 - channel = client.get_channel(channel_id) - serverss = _ba.app.server._config.party_name - - if not channel: - print(f"Channel with ID {channel_id} not found.") - return - - message = ( - f"**__{serverss}__\n=========================================**\n> |`PLAYER SIZE:` {len(stats['roster'])}/{ba.internal.get_public_party_max_size()}\n> \n" - f"**=========================================**" - ) - await channel.send(message) - #print(f"{devices_string}... Notification send Successfully!") - -@client.event -async def on_message(message): - global channel - if message.author == client.user: - return - channel = message.channel - - if message.channel.id == logsChannelID: - _ba.pushcall(Call(ba.internal.chatmessage, message.content), from_other_thread=True) - else: - if message.content.startswith(prefix): - if message.guild.id not in whitelisted_servers: - print(f"Server ID {message.guild.id} is not whitelisted.Someone is trying to use {client.user.name} in other servers") - try: - guild = client.get_guild(message.guild.id) - server_name = guild.name if guild else "Unknown Server" - print(f"Unauthorized attempt in server: {server_name}") - except Exception as e: - print(f"Error retrieving server name: {e}") - await message.channel.send("**Unauthorized server. This server is not whitelisted. Don't try to use cmds kid...!**") - return - - if message.author.id not in whitelisted_users: - await message.channel.send("**You do not have permission to use this command.**") - return - - cmd = commands_prefix - servers = _ba.app.server._config.party_name - m = message.content[2:].split() - if m[0] == 'bsunban': #unban in all server xD - if len(m) == 2: - pb_id_to_unban = m[1] - banned = mongo.banlist.find_one() or {'ban': {'ids': [], 'deviceids': [], 'ips': []}} - - if pb_id_to_unban in banned['ban']['ids']: - index = banned['ban']['ids'].index(pb_id_to_unban) - device_id = banned['ban']['deviceids'][index] - ip_address = banned['ban']['ips'][index] - - banned['ban']['ids'].remove(pb_id_to_unban) - banned['ban']['deviceids'].pop(index) - banned['ban']['ips'].pop(index) - - mongo.banlist.delete_many({}) - mongo.banlist.insert_one(banned) - - await message.channel.send(f">>>**Successfully unbanned `{pb_id_to_unban}` in all servers <:unban:1187466551369158746>**") - else: - await message.channel.send(">>>**`I can't find that PB-ID in my database`** 😕!") - else: - await message.channel.send(">>>**Invalid Format! Use `{0}bsunban `**".format(prefix)) - - # quit in all server :)))))) - elif m[0] == 'quit': - await message.channel.send(">>>**`Successfully restarted all servers`**") - ba.quit() - - # add player data whom notify you want in Discord server xD - elif m[0] == 'addnotify': - if len(m) == 4: - data = mongo.notify_list.find_one() or {'notify': {'ids': [], 'deviceids': [],'ips': []}} - player_id = m[1] - device_id = m[2] - ip = m[3] - - if player_id not in data['notify']['ids'] and device_id not in data['notify']['deviceids'] and ip not in data['notify']['ips']: # Use get method to handle potential missing key - data['notify']['ids'].append(player_id) - data['notify']['deviceids'].append(device_id) - data['notify']['ips'].append(ip) - mongo.notify_list.delete_many({}) # Move the update_notify call inside the condition - mongo.notify_list.insert_one(data) - await message.channel.send(f">>>**Successfully added Player ID {player_id} in the Notify list**") - else: - await message.channel.send(f">>>**Player ID {player_id} is already in the Notify list**") - else: - await message.channel.send(">>>**Invalid Format! Use `{0}addnotify `**".format(prefix)) - - # remove account ID of a player you don't want to notify in the DC server :) - elif m[0] == 'removenotify': - if len(m) == 2: - player_id = m[1] - data = mongo.notify_list.find_one() or {'notify': {'ids': [], 'deviceids': [],'ips': []}} - - if player_id in data['notify']['ids']: - index = data['notify']['ids'].index(player_id) - device_id = data['notify']['deviceids'][index] - ip = data['notify']['ips'][index] - - data['notify']['ids'].remove(player_id) - data['notify']['deviceids'].pop(index) - data['notify']['ips'].pop(index) - mongo.notify_list.delete_many({}) - mongo.notify_list.insert_one(data) - await message.channel.send(f">>>**Successfully Removed Player ID {player_id} from the Notify list**") - else: - await message.channel.send(f">>>**Player ID {player_id} is not in the Notify list**") - else: - await message.channel.send(">>>**Invalid Format! Use `{0}removenotify `**".format(prefix)) - - #to check if player is there in notify list or not :) - elif m[0] == 'checknotify': - data = mongo.notify_list.find_one() or {'notify': {'ids': [], 'deviceids': [],'ips': []}} - if data and 'notify' in data: - notify_ids = data['notify']['ids'] - notify_device_ids = data['notify']['deviceids'] - notify_ips = data['notify']['ips'] - - if len(m) == 2: - pb_id_to_check = m[1] - if pb_id_to_check in notify_ids: - index = notify_ids.index(pb_id_to_check) - device_id = notify_device_ids[index] - ip = notify_ips[index] - await message.channel.send(f">>>**Player with PB-ID `{pb_id_to_check}` is in the notify list**") - else: - await message.channel.send(f">>>**Player with PB-ID `{pb_id_to_check}` is not found in the notify list**") - else: - await message.channel.send(">>>Invalid Format! Use `{0}checknotify `**".format(prefix)) - - # to find out how many complaint does the user have done :)) - elif m[0] == 'complain': - complain = mongo.complaint_count.find_one() or {'complainter': {'pb_id': [], 'name': [], 'count': []}} - if complain and 'complainter' in complain: - complain_ids = complain['complainter']['pb_id'] - complain_name = complain['complainter']['name'] - complain_count = complain['complainter']['count'] - - if len(m) == 2: - pb_id_to_check = m[1] - if pb_id_to_check in complain_ids: - index = complain_ids.index(pb_id_to_check) - name = complain_name[index] - count = complain_count[index] - complain_message = ( - f"> |`PLAYER-NAME:` {name}\n> |`PLAYER PB-ID:` {pb_id_to_check}\n> |`COMPLAIN COUNT:` {count}" - ) - await message.channel.send(complain_message) - else: - await message.channel.send(f">>>**`Player with PB-ID {pb_id_to_check} hasn't submitted any complaints so far.`**") - else: - await message.channel.send(">>> **Invalid Format! Use `{0}complain `**".format(prefix)) - - # to find out how many complaints does this user have xD - elif m[0] == 'complaints': - complaints = mongo.complaints_count.find_one() or {'complaints': {'pb_id': [], 'name': [], 'count': []}} - if complaints and 'complaints' in complaints: - complaints_ids = complaints['complaints']['pb_id'] - complaints_name = complaints['complaints']['name'] - complaints_count = complaints['complaints']['count'] - - if len(m) == 2: - pb_id_to_check = m[1] - if pb_id_to_check in complaints_ids: - index = complaints_ids.index(pb_id_to_check) - name = complaints_name[index] - count = complaints_count[index] - complaints_message = ( - f"> |`PLAYER-NAME:` {name}\n> |`PLAYER PB-ID:` {pb_id_to_check}\n> |`COMPLAINTS COUNT:` {count}" - ) - await message.channel.send(complaints_message) - else: - await message.channel.send(f">>>**`Player with PB-ID {pb_id_to_check} hasn't received any complaints yet.`**") - else: - await message.channel.send(">>> Invalid Format! Use `{0}complaints `**".format(prefix)) - - #check last 15 complain players :D - elif m[0] == 'complainlist': - complain = mongo.complaint_count.find_one() or {'complainter': {'pb_id': [], 'name': [], 'count': []}} - if complain and 'complainter' in complain: - complain_ids = complain['complainter']['pb_id'] - complain_name = complain['complainter']['name'] - complain_count = complain['complainter']['count'] - - if complain_ids: - complain_messages = [ - f">>>**Last 15 Complain Players ({len(complain_ids)}):**" - ] - - start_index = max(0, len(complain_ids) - 15) - for i in range(start_index, len(complain_ids)): - pbid = complain_ids[i] - name = complain_name[i] - count = complain_count[i] - complain_messages.append(f"**PB-ID: `{pbid}`, Name: `{name}`,complaints registered for this player: `{count}`**") - - await message.channel.send("\n".join(complain_messages)) - else: - await message.channel.send("**`No players are currently complain.`**") - else: - await message.channel.send("**No complain data found.**") - - #check last 15 complaints players :D - elif m[0] == 'complaintslist': - complaints = mongo.complaints_count.find_one() or {'complaints': {'pb_id': [], 'name': [], 'count': []}} - if complaints and 'complaints' in complaints: - complaints_ids = complaints['complaints']['pb_id'] - complaints_name = complaints['complaints']['name'] - complaints_count = complaints['complaints']['count'] - - if complaints_ids: - complaints_messages = [ - f">>>**Last 15 Complaints Players ({len(complaints_ids)}):**" - ] - - start_index = max(0, len(complaints_ids) - 15) - for i in range(start_index, len(complaints_ids)): - pbid = complaints_ids[i] - name = complaints_name[i] - count = complaints_count[i] - complaints_messages.append(f"**PB-ID: `{pbid}`, Name: `{name}`, Complaints Count: `{count}`**") - - await message.channel.send("\n".join(complaints_messages)) - else: - await message.channel.send("**`No players are currently complaints.`**") - else: - await message.channel.send("**No complaints data found.**") - - #cmds guide :) - elif m[0] == 'help': - help_messages = [ - f">>> ## **📜__COMMANDz GUIDE__ :) ** \n### __(To find out server code type {prefix}sc) __", - f":arrow_right: **__Banning and Unbanning:__**\nType `{prefix}ban` to learn how to ban and unban a player.", - f":arrow_right: **__Muting and Unmuting:__**\nType `{prefix}mute` to understand how to mute and unmute a player.", - f":arrow_right: **__Create & Remove Role and Change Role tag Commands:__**\nType `{prefix}createrole` to find out how to create & remove role and change role tag.", - f":arrow_right: **__Adding and Removing Roles:__**\nType `{prefix}addroles` to discover how to add and remove roles from a player.", - f":arrow_right: **__Remove Roles and Custom ID's:__**\nType `{prefix}removeids` to find out how to remove ID's from roles and customs.", - f":arrow_right: **__Adding and Removing Commands from Roles:__**\nType `{prefix}addcmds` to find out how to add and remove commands from a role.", - f":arrow_right: **__Kick and Kick-vote Commands:__**\nType `{prefix}kickcmd` to find out how to use kick and kick vote cmds.", - f":arrow_right: **__Sending Messages in Servers:__**\nType `{prefix}msg` to learn how to send messages in servers.", - f":arrow_right: **__Custom Tags and Effects:__**\nType `{prefix}customs` to know how to add and remove custom tags or effects from a player.", - f":arrow_right: **__Checking Player Data:__**\nType `{prefix}checkdata` to view all data related to a player.", - f":arrow_right: **__Change Stats Data:__**\nType `{prefix}csdata` to know how to change statsdata of a player." - ] - await message.channel.send("\n".join(help_messages)) - help_message = [ - f">>> :arrow_right: **__List and Count of Roles in Server:__**\nType `{prefix}roleslc` to see the list and count of roles in the server.", - f":arrow_right: **__ Notifications and Complaint Commands:__**\nType `{prefix}nac` to learn about notification and complaint commands.", - f":arrow_right: **__Restarting (Quitting) the Server:__**\nType `{prefix}restart` to understand how to restart or quit the server.", - f":arrow_right: **__Adding Users to Whitelist:__**\nType `{prefix}user` to learn how to add a user to the whitelist, allowing them to use all bot commands." - ] - await message.channel.send("\n".join(help_message)) - - elif m[0] == 'ban': - await message.channel.send(f">>> ## __(To find out server code type {prefix}sc) __\n**__BAN AND UNBAN COMMANDz:__**\n`{prefix}bsban (pbid) (deviceid) (ip)` - To ban a player in all servers.\n`{prefix}bsunban (pbid)` - To unban a player from all servers.\n`{prefix}(server-code)ban (pbid) (time in days) (reason no space)` - To ban a player in a specific server.\n`{prefix}(server-code)unban (pbid)` - To unban a player from a specific server. ") - - elif m[0] == 'mute': - await message.channel.send(f">>> ## __(To find out server code type {prefix}sc) __\n**__MUTE AND UNMUTE COMMANDz:__**\n`{prefix}bsmute (pbid) (time in minutes) (reason no space)` - To mute a player in all servers.\n`{prefix}bsunmute (pbid)` - To unmute a player from all servers.\n`{prefix}(server-code)mute (pbid) (time in minutes) (reason no space)` - To mute a player in a specific server.\n`{prefix}(server-code)unmute (pbid)` - To unmute a player from a specific server. ") - - elif m[0] == 'createrole': - await message.channel.send(f">>> ## __(To find out server code type {prefix}sc) __\n**__CREATE & REMOVE ROLE AND CHANGE ROLE TAG COMMANDz:__**\n`{prefix}cr (role) (tag)` - To create a role and add roles tag in all servers.\n`{prefix}rr (role) ` - To remove a role from all servers.\n`{prefix}(server-code)cr (role) (tag)` - To create a role and add roles tag in a specific server.\n`{prefix}(server-code)rr (role)` - To remove a role from a specific server.\n`{prefix}crt (role) (tag)` - To change roles tag in all servers.\n`{prefix}(server-code)crt (role) (tag)` - To change roles tag in a specific server. ") - - elif m[0] == 'addroles': - await message.channel.send(f">>> ## __(To find out server code type {prefix}sc) __\n**__ADDROLES COMMANDz:__**\n`{prefix}addrole (pbid) (role)` - To add any role to a player in all servers.\n`{prefix}removerole (pbid) (role)` - To remove any role from a player in all servers.\n`{prefix}(server-code)addrole (pbid) (role)` - To add any role to a player in a specific server.\n`{prefix}(server-code)removerole (pbid) (role)` - To remove any role from a player in a specific server. ") - - elif m[0] == 'addcmds': - await message.channel.send(f">>> ## __(To find out server code type {prefix}sc) __\n**__ADDCMD TO ROLE COMMANDz:__**\n`{prefix}asac (role) (command)` - To add command in any role in all servers.\n`{prefix}asrc (role) (command)` - To remove command from any role in all servers.\n`{prefix}(server-code)ac (role) (command)` - To add command in any role in a specific server.\n`{prefix}(server-code)rc (role) (commamd)` - To remove command from any role in a specific server. ") - - elif m[0] == 'msg': - await message.channel.send(f">>> ## __(To find out server code type {prefix}sc) __\n**__MSG COMMANDz:__**\n`{prefix}im (server-name) (message)` - To send important message in all servers in one click....!\n`{prefix}(server-code)im (server-name) (message)` - To send important message in a specific server. ") - - elif m[0] == 'customs': - await message.channel.send(f">>> ## __(To find out server code type {prefix}sc) __\n**__CUSTOMTAG AND EFFECT COMMANDz:__**\n`{prefix}(server-code)tagadd (pbid) (tag)` - To add customtag to player in a specific server.\n`{prefix}(server-code)tagremove (pbid)` - To remove customtag from a player in a specific server.\n`{prefix}tagadd (pbid) (tag)` - To add customtag to player in all servers.\n`{prefix}tagremove (pbid)` - To remove customtag from a player in all servers.\n`{prefix}(server-code)effectadd (pbid) (effect)` - To add customeffect to player in a specific server.\n`{prefix}(server-code)effectremove (pbid)` - To remove customeffect from a player in a specific server.\n`{prefix}effectadd (pbid) (effect)` - To add customeffect to player in all servers.\n`{prefix}effectremove (pbid)` - To remove customeffect from a player in all servers.") - - elif m[0] == 'removeids': - await message.channel.send(f">>> ## __(To find out server code type {prefix}sc) __\n**__REMOVE ROLES & CUSTOMS ID'S COMMANDz:__**\n`{prefix}(server-code)rids (role)` - To remove roles all ID's from specific server.\n`{prefix}rids (role)` - To remove rolea all ID's from all servers.\n`{prefix}(server-code)rcids (custom)` - To remove customs all ID's from specific server.\n`{prefix}rcids (custom)` - To remove customs all ID's from all servers. ") - - elif m[0] == 'checkdata': - await message.channel.send(f">>> ## __(To find out server code type {prefix}sc) __\n**__CHECK ALL DATA COMMANDz:__**\n`{prefix}bancheck (pbid)` - Check if a player is banned or unbanned in all servers.\n`{prefix}(server-code)bancheck (pbid)` - Check if a player is banned or unbanned in a specific server.\n`{prefix}getroles (pbid)` - Get info about the number of roles a player has across all servers.\n`{prefix}(server-code)getroles (pbid)` - Get info about the number of roles a player have in a specific server.\n`{prefix}(server-code)checktag (pbid)` - Check if a player has a custom tag in a specific server.\n`{prefix}(server-code)checkeffect (pbid)` - Check if a player has a custom effect in a specific server.\n`{prefix}(server-code)pdata (pbid)` - View a player's data (score, rank etc) on the specific server.\n`{prefix}(server-code)bandata (pbid)` - View a player's ban data (ip, device-id etc) on the specific server.\n`{prefix}(server-code)top10` - View the Top 10 players in the specific server.\n`{prefix}(server-code)recents (limit)` - To Know Recently joined players in the specific server.\n`{prefix}(server-code)lm (limit)` - To know all last messages of specific server.\n`{prefix}(server-code)plm (pbid) (limit)` - To know player last messages of specific server.\n`{prefix}(server-code)mp (count)` - To do Maximum player set in the specific server. ") - - elif m[0] == 'csdata': - await message.channel.send(f">>> ## __(To find out server code type {prefix}sc) __\n**__CHANGE ANY STATS-DATA COMMANDz:__**\n`{prefix}addcoins (pbid) (count)` - Add coins to a player in all servers.\n`{prefix}removecoins (pbid) (count)` - Remove coins from player in all servers.\n`{prefix}(server-code)addcoins (pbid) (count)` - Add coins to a player in a specific server.\n`{prefix}(server-code)removecoins (pbid) (count)` - Remove coins from player in specific server.\n`{prefix}(server-code)csd (pbid) (statsdata to change) (count)` - Change (statsdata) of a player in a specific server.\nUse statsdata - `scores, kills, deaths, games, kd`") - - elif m[0] == 'kickcmd': - await message.channel.send(f">>> ## __(To find out server code type {prefix}sc) __\n**__KICK AND KICK-VOTE COMMANDz:__**\n`{prefix}(server-code)kick (pbid)` - To kick in-game player from a specific server.\n`{prefix}dkickvote (pbid) (time in days) (reason no space)` - To disable server kick-vote for a player in all servers.\n`{prefix}ekickvote (pbid)` - To enable server kick-vote for a player in all servers.\n`{prefix}(server-code)dkickvote (pbid) (time in days) (reason no space)` - To disable server kick-vote for a player in a specific server.\n`{prefix}(server-code)ekickvote (pbid)` - To enable server kick-vote for a player in a specific server.") - - elif m[0] == 'roleslc': - await message.channel.send(f">>> ## __(To find out server code type {prefix}sc) __\n**__LIST & COUNT COMMANDz:__**\n`{prefix}banlist` - Ascertain last 10 banned players of all servers.\n`{prefix}(server-code)banlist` - Ascertain last 10 banned players of specific server.\n`{prefix}complainlist` - Ascertain last 15 complain players & counts.\n`{prefix}complaintslist` - Ascertain last 15 complaints players & counts.\n`{prefix}(server-code)mutelist` - Find out muted players of specific server.\n`{prefix}(server-code)roleslist` - Find out all roles of specific server.\n`{prefix}(server-code)dkickvotelist` - Find out disable server kick-vote players of specific server.\n`{prefix}(server-code)viplist` - Find out VIPs list & count of specific server.\n`{prefix}(server-code)adminlist` - Find out Admins list & count of specific server.\n`{prefix}(server-code)cslist` - Find out CS list & count of specific server.\n`{prefix}(server-code)modlist` - Find out Moderators list & count of specific server.\n`{prefix}(server-code)leadstafflist` - Find out Leadstaff list & count of specific server.\n`{prefix}(server-code)ownerlist` - Find out Owners list & count of specific server.\n`{prefix}(server-code)taglist` - Find out CustomTag players list & count of specific server.\n`{prefix}(server-code)effectlist` - Find out CustomEffect players list & count of specific server.\n`{prefix}(server-code)cmdlist ` - Find out Roles Cmdlist of specific server.\n`{prefix}aeffectlist` - Find out Available CustomEffects list of all servers. ") - - elif m[0] == 'nac': - await message.channel.send(f">>> **__NOTIFICATIONS AND COMPLAINT COMMANDz:__**\n`{prefix}addnotify (pbid) (deviceid) (ip)` - To add the player in the notification list.\n`{prefix}removenotify (pbid)` - To remove the player from the notification list.\n`{prefix}checknotify (pbid)` - Verify whether the player is included in the notification list or not..\n`{prefix}complain (pbid)` - Check the total number of complaints registered by that player.\n`{prefix}complaints (pbid)` - Check the total number of complaints registered for that player.") - - elif m[0] == 'restart': - await message.channel.send(f">>> ## __(To find out server code type {prefix}sc) __\n**__SERVER QUIT COMMANDz:__**\n`{prefix}quit` - To restart all servers in one click...!\n`{prefix}(server-code)quit` - To restart a specific server :> ") - - elif m[0] == 'user': - await message.channel.send(f">>> **__WHITELIST COMMANDz:__**\n`{prefix}useradd (dc user-ID)` - To add a user to the whilelist to use all bot commands.\n`{prefix}userremove (dc user-ID)` - To remove a user from the whitelist.\n`{prefix}form (role)` - Use this cmd to give a form to user if his eligible for admin or vip") - - # server have a pecific code to use cmd xD and this cmd made to know code of cmd - elif m[0] == 'sc': - await message.channel.send(">>> **{0} - {1}**".format(commands_prefix, servers)) - - #check last messages xD - elif m[0] == (cmd +'lm'): - try: - settings = setting.get_settings_data() - lm = settings["discordbot"]["lastmsg"] - limit = int(m[1]) if len(m) > 1 and m[1].isdigit() else 10 # Default limit is 10 if not provided or not a number - max_messages = 2000 - - if limit > max_messages: - await message.channel.send("**`Limit exceeds maximum word count of 2000.`**") - else: - # Define the file path within the tools directory - directory_path = os.path.join(_ba.env()["python_directory_user"], "tools") - file_path = os.path.join(directory_path, f"{lm}_messages.txt") - - with open(file_path, "r") as file: - messages = file.readlines() - - if messages: - # Get the last `limit` messages - pbid_messages = [msg.strip() for msg in messages if msg.startswith("pb-")] - - last_msg = [ - f">>> **({len(messages)}) Last {limit} Messages Data of {servers}:**" - ] - - if limit > max_messages: - chunks = [pbid_messages[i:i+max_messages] for i in range(0, len(pbid_messages), max_messages)] - for chunk in chunks: - last_msg.append("\n".join([f"**{msg.strip()}**" for msg in chunk])) - else: - # Prepare the message to sen - for msg in pbid_messages[-limit:]: - last_msg.append(f"**{msg.strip()}**") - - await message.channel.send("\n".join(last_msg)) - else: - await message.channel.send(f"**`No One has messaged in {servers}.`**") - except: - await message.channel.send("**`Limit exceeds maximum word count of 2000.`**") - - #check player last messages xD - elif m[0] == (cmd +'plm'): - try: - if len(m) == 3: - settings = setting.get_settings_data() - lm = settings["discordbot"]["lastmsg"] - pbids = m[1] - limit = int(m[2]) if m[2].isdigit() else 10 # Default limit is 10 if not provided or not a number - max_messages = 2000 - - if limit > max_messages: - await message.channel.send("**`Limit exceeds maximum word count of 2000.`**") - else: - # Define the file path within the tools directory - directory_path = os.path.join(_ba.env()["python_directory_user"], "tools") - file_path = os.path.join(directory_path, f"{lm}_messages.txt") - - with open(file_path, "r") as file: - messages = file.readlines() - - if messages: - pbid_messages = [msg for msg in messages if msg.startswith(f'{pbids}')][-limit:] - if pbid_messages: - last_msg = [ - f">>> **Player Last {limit} Messages Data of {servers}:**" - ] - for msg in pbid_messages: - last_msg.append(f"**{msg.strip()}**") - - await message.channel.send("\n".join(last_msg)) - else: - await message.channel.send(f"**`No last messages found for the provided player ID in {servers}`**") - else: - await message.channel.send(f"**`No One has messaged in {servers}.`**") - else: - await message.channel.send(">>> **Invalid Format! Use `{0}{1}plm `**".format(prefix, commands_prefix)) - except: - await message.channel.send("**`Limit exceeds maximum word count of 2000.`**") - - # quit in single server :) - elif m[0] == (cmd +'quit'): - await message.channel.send(">>> **`Successfully restarted {0}` **".format(servers)) - ba.quit() - - # add coins to player in a specific server - elif m[0] == (cmd +'addcoins'): - if len(m) == 3: - ac = m[1] - count = int(m[2]) - coin = nc.getcoins(ac) - if coin: - addcoins(ac, count) - await message.channel.send(f">>> **Successfully added {count} coins to PB ID `{ac}` in {servers}**") - else: - await message.channel.send(f">>> **User `{ac}` is not there in my bankdata in {servers}**") - else: - await message.channel.send(">>> **Invalid Format! Use `{0}{1}addcoins `**".format(prefix, commands_prefix)) - - # remove coins to player in a specific server - elif m[0] == (cmd +'removecoins'): - if len(m) == 3: - ac = m[1] - count = int(m[2]) - coin = nc.getcoins(ac) - if coin: - removecoins(ac, count) - await message.channel.send(f">>> **Successfully Removed {count} coins from PB ID `{ac}` in {servers}**") - else: - await message.channel.send(f">>> **User `{ac}` is not there in my bankdata in {servers}**") - else: - await message.channel.send(">>> **Invalid Format! Use `{0}{1}removecoins `**".format(prefix, commands_prefix)) - - # add coins to player in all servers - elif m[0] == 'addcoins': - if len(m) == 3: - ac = m[1] - count = int(m[2]) - coin = nc.getcoins(ac) - if coin: - addcoins(ac, count) - await message.channel.send(f">>> **Successfully added {count} coins to PB ID `{ac}` in {servers}**") - else: - await message.channel.send(f">>> **User `{ac}` is not there in my bankdata in {servers}**") - else: - await message.channel.send(">>> **Invalid Format! Use `{0}{1}addcoins `**".format(prefix)) - - # remove coins to player in all servers - elif m[0] == 'removecoins': - if len(m) == 3: - ac = m[1] - count = int(m[2]) - coin = nc.getcoins(ac) - if coin: - removecoins(ac, count) - await message.channel.send(f">>> **Successfully Removed {count} coins from PB ID `{ac}` in {servers}**") - else: - await message.channel.send(f">>> **User `{ac}` is not there in my bankdata in {servers}**") - else: - await message.channel.send(">>> **Invalid Format! Use `{0}removecoins `**".format(prefix)) - - # add server stats data in specific server - elif m[0] == (cmd +'csd'): - if len(m) == 4: - stats = mystats.get_all_stats() - pbid = m[1] - reply = m[2] - space = "" - statsdata = space+reply+space - data = int(m[3]) - - if pbid in stats: - stats[pbid][statsdata] = data - mystats.dump_stats(stats) - mystats.refreshStats() - await message.channel.send(f">>> **`{m[1]}` `{reply}` changed to `{data} {reply}` in {servers}**") - else: - await message.channel.send(f">>> **User `{m[1]}` statsdata is not available in {servers}**") - - else: - await message.channel.send(">>> **Invalid Format! Use `{0}{1}csd `**".format(prefix, commands_prefix)) - - #to check who joined recently in specific server xD - elif m[0] == (cmd +'recents'): - limit = 10 # Default limit - - if len(m) >= 2: - # Try to parse the second argument as the limit - try: - limit = int(m[1]) - except ValueError: - # If the argument cannot be parsed as an integer, use the default limit - pass - - if serverdata.recents: - await message.channel.send(f">>> **Recently Joined Players Data of {servers}:**") - for i, players in enumerate(serverdata.recents[:limit]): - await message.channel.send(f">>> **Name: {players['deviceId']}, PlayerID: {players['pbid']}, ClientID: {players['client_id']} **") - if i == limit - 1: # Check if we reached the limit - break - else: - await message.channel.send(f">>> **No one played currently in {servers} **") - - #maxplayer set from dc in specific server. :)))) - elif m[0] == (cmd +'mp'): - if len(m) == 2: - mp = int(m[1]) - sp = m[1] - if mp: - ba.internal.set_public_party_max_size(mp) - await message.channel.send(f">>> **Maximum players set to {mp} in {servers}**") - else: - await message.channel.send(f">>> **Error!!: Enter number**") - else: - await message.channel.send(">>> **Invalid Format! Use `{0}{1}mp `**".format(prefix, commands_prefix)) - - # cmd list of any role in a specific server :) - elif m[0] == (cmd +'cmdlist'): - a = message.content.lower().split() - b = message.content.upper().split() - if len(a) == 2 or len(b) == 2: - roles = pdata.get_roles() - rol = b[1] - role = a[1] - if role in roles: - role_data = [ - f">>> **__{rol}'S COMMANDS LIST OF {servers}:__**" - ] - - data = pdata.roles_cmdlist(role) - role_data.append(f"{data}") - await message.channel.send("\n".join(role_data)) - else: - await message.channel.send(f">>> **Use Roles: `Owner, Moderator, Staff, Admin, Vip`**") - else: - await message.channel.send(">>> **Invalid Format! Use `{0}{1}cmdlist `**".format(prefix, commands_prefix)) - - # to kick player from server by Discord Cmd xD - elif m[0] == (cmd +'kick'): - if len(m) == 2: - pbid = m[1] - if serverdata.recents: - pdata.dckick(pbid) - await message.channel.send(f">>> **kicked `{pbid}` from {servers}**") - else: - await message.channel.send(f">>> **`{pbid}` not joined the server yet..!**") - else: - await message.channel.send(">>> **Invalid Format! Use `{0}{1}kick `**".format(prefix, commands_prefix)) - - - # vh paradise form for admin and vip xD - elif m[0] == 'form': - b = message.content.upper().split() - a = message.content.lower().split() - if len(a) == 2 or len(b) == 2: - roles = ['admin', 'vip'] - rol = a[1] - role = b[1] - if rol in roles: - role_form = ( - f">>> | **___YOU'RE ELIGIBLE FOR {role}...___**\n | **FORM -** https://form.jotform.com/232155604519050\n" - f" | **`PASSWORD`** - **vortex123**\n | **___`FILL THIS FORM AND LET US KNOW...`___**" - ) - await channel.send(role_form) - else: - await channel.send(f">>> **`Use Roles: admin, vip`**") - - else: - await message.channel.send(">>> **Invalid Format! Use `{0}form `**".format(prefix)) - - # ban in all server xD - elif m[0] == 'bsban': - m = message.content[2:].split() - if m[0] == 'bsban': - if len(m) == 4: - banned = mongo.banlist.find_one() or {'ban': {'ids': [], 'deviceids': [],'ips': []}} - pb_id, device_id, ip_address= m[1], m[2],m[3] - if pb_id in banned['ban']['ids'] and device_id in banned['ban']['deviceids'] and ip_address in banned['ban']['ips']: - await message.channel.send(f">>> **User is already banned in {servers}** <:emoji_55:995906513031929897>") - else: - banned['ban']['ids'].append(m[1]) - banned['ban']['deviceids'].append(m[2]) - banned['ban']['ips'].append(m[3]) - mongo.banlist.delete_many({}) - mongo.banlist.insert_one(banned) - # print("After banning:") - # print("IDs:", banned['ban']['ids']) - # print("IPs:", banned['ban']['ips']) - # print("Device IDs:", banned['ban']['deviceids']) - await message.channel.send(f">>> **Successfully banned `{m[1]}` in all servers <:ban:1121663704379961465>**") - pdata.mongokick(pb_id) - else: - await message.channel.send(">>> **Invalid Format! Use `{0}bsban `!!**".format(prefix)) - - #check banned player in all servers :))) - elif m[0] == 'bancheck': - banned = mongo.banlist.find_one() or {'ban': {'ids': [], 'deviceids': [], 'ips': []}} - if banned and 'ban' in banned: - banned_ids = banned['ban']['ids'] - banned_device_ids = banned['ban']['deviceids'] - banned_ips = banned['ban']['ips'] - - if len(m) == 2: - pb_id_to_check = m[1] - if pb_id_to_check in banned_ids: - index = banned_ids.index(pb_id_to_check) - device_id = banned_device_ids[index] - ip = banned_ips[index] - await message.channel.send(f">>> **`Player with PB-ID {pb_id_to_check} is Banned in all servers.Device-ID: {device_id}, IP: {ip}` <:ban:1121663704379961465> **") - else: - await message.channel.send(">>> **`Player with PB-ID : {0} is not banned in all servers.`**".format(pb_id_to_check)) - else: - await message.channel.send(">>> **Invalid Format! Use `{0}bancheck `**".format(prefix)) - - # check banned player in specific server - elif m[0] == (cmd +'bancheck'): - blacklist_data = pdata.get_blacklist() - - if blacklist_data and 'ban' in blacklist_data: - banned_ids = blacklist_data['ban']['ids'] - banned_device_ids = blacklist_data['ban']['deviceids'] - banned_ips = blacklist_data['ban']['ips'] - - if len(m) == 2: - pb_id_to_check = m[1] - if pb_id_to_check in banned_ids: - await message.channel.send(f">>> **`Player with PB-ID {pb_id_to_check} is Banned in {servers}!` <:ban:1121663704379961465> **") - else: - await message.channel.send(">>> **`Player with PB-ID : {0} is not banned in {1}.`**".format(pb_id_to_check, servers)) - else: - await message.channel.send(">>> **Invalid Format! Use `{0}{1}bancheck `**".format(prefix, commands_prefix)) - - #check last 10 banned players :D - elif m[0] == 'banlist': - banned = mongo.banlist.find_one() or {'ban': {'ids': [], 'deviceids': [], 'ips': []}} - if banned and 'ban' in banned: - banned_ids = banned['ban']['ids'] - banned_device_ids = banned['ban']['deviceids'] - banned_ips = banned['ban']['ips'] - - if banned_ids: - ban_messages = [ - f">>> <:Cross:1178624823656714280> **Last 10 Banned Players ({len(banned_ids)}):**" - ] - - start_index = max(0, len(banned_ids) - 10) - for i in range(start_index, len(banned_ids)): - pb_id = banned_ids[i] - device_id = banned_device_ids[i] - ip = banned_ips[i] - ban_messages.append(f"**`PB-ID: {pb_id}, Device-ID: {device_id}, Ip: {ip}` **") - - await message.channel.send("\n".join(ban_messages)) - else: - await message.channel.send("**`No players are currently banned.`**") - else: - await message.channel.send("**No ban data found.**") - - #check the admin list and count - elif m[0] == (cmd +'adminlist'): - roles = pdata.get_roles() - stats = mystats.get_all_stats() - if roles and 'admin' in roles: - admin_ids = roles['admin']['ids'] - if admin_ids: - await message.channel.send(f">>> **Admins_Count ({len(admin_ids)}):**") - for i in range(len(admin_ids)): - pb_id = admin_ids[i] - await message.channel.send(f">>> **PB-ID: `{pb_id}`**") - name = stats[pb_id]['name'] - score = stats[pb_id]['scores'] - rank = stats[pb_id]['rank'] - await message.channel.send(f">>> **[ Name: `{name}`, Rank: `{rank}`, Scores: `{score}` ]**") - else: - await message.channel.send(">>> **`No one is admin currently in {0}.`**".format(servers)) - else: - await message.channel.send(">>> **No admin data found.**") - - #vip count cmd - elif m[0] == (cmd +'viplist'): - roles = pdata.get_roles() - stats = mystats.get_all_stats() - if roles and 'vip' in roles: - vip_ids = roles['vip']['ids'] - if vip_ids: - await message.channel.send(f">>> **Vips_Count ({len(vip_ids)}):**") - for i in range(len(vip_ids)): - pb_id = vip_ids[i] - await message.channel.send(f">>> **PB-ID: `{pb_id}`**") - name = stats[pb_id]['name'] - score = stats[pb_id]['scores'] - rank = stats[pb_id]['rank'] - await message.channel.send(f">>> **[ Name: `{name}`, Rank: `{rank}`, Scores: `{score}` ]**") - else: - await message.channel.send(">>> **`No one is vip currently in {0}.`**".format(servers)) - else: - await message.channel.send(">>> **No vip data found.**") - - #cs count cmd - elif m[0] == (cmd +'cslist'): - roles = pdata.get_roles() - if roles and 'staff' in roles: - cs_ids = roles['staff']['ids'] - if cs_ids: - await message.channel.send(f">>> **CS_Count ({len(cs_ids)}):**") - for i in range(len(cs_ids)): - pb_id = cs_ids[i] - await message.channel.send(f">>> **PB-ID: `{pb_id}`**") - else: - await message.channel.send(">>> **`No one is cs currently in {0}.`**".format(servers)) - else: - await message.channel.send(">>> **No cs data found.**") - - #mod count cmd - elif m[0] == (cmd +'modlist'): - roles = pdata.get_roles() - if roles and 'moderator' in roles: - mod_ids = roles['moderator']['ids'] - if mod_ids: - await message.channel.send(f">>> **Mods_Count ({len(mod_ids)}):**") - for i in range(len(mod_ids)): - pb_id = mod_ids[i] - await message.channel.send(f">>> **PB-ID: `{pb_id}`**") - else: - await message.channel.send(">>> **`No one is mod currently in {0}.`**".format(servers)) - else: - await message.channel.send(">>> **No mod data found.**") - - #leadstaff count cmd - elif m[0] == (cmd +'leadstafflist'): - roles = pdata.get_roles() - if roles and 'leadstaff' in roles: - leadstaff_ids = roles['leadstaff']['ids'] - if leadstaff_ids: - await message.channel.send(f">>> **Leadstaffs_Count ({len(leadstaff_ids)}):**") - for i in range(len(leadstaff_ids)): - pb_id = leadstaff_ids[i] - await message.channel.send(f">>> **PB-ID: `{pb_id}`**") - else: - await message.channel.send(f">>> **`No one is leadstaff currently in {servers}.`**") - else: - await message.channel.send(">>> **No leadstaff data found.**") - - #roles count cmd :)))))) - elif m[0] == (cmd +'roleslist'): - custom_data = pdata.get_roles() - reply = "" - tag_data = custom_data - if tag_data: - tag_count = len(tag_data) - await message.channel.send(f">>> **`({tag_count})` Roles in {servers}:**") - for role in tag_data: - reply = reply+role+", " - await message.channel.send(f">>> **{reply}**") - else: - await message.channel.send(f">>> **`No roles currently in {servers}.`**") - - #owner count cmd - elif m[0] == (cmd +'ownerlist'): - roles = pdata.get_roles() - if roles and 'owner' in roles: - owner_ids = roles['owner']['ids'] - if owner_ids: - await message.channel.send(f">>> **Owners_Count ({len(owner_ids)}):**") - for i in range(len(owner_ids)): - pb_id = owner_ids[i] - await message.channel.send(f">>> **PB-ID: `{pb_id}`**") - else: - await message.channel.send(">>> **`No one is owner currently in {0}.`**".format(servers)) - else: - await message.channel.send(">>> **No owner data found.**") - - #tag count cmd :)))))) - elif m[0] == (cmd +'taglist'): - custom_data = pdata.get_custom() - if custom_data and 'customtag' in custom_data: - tag_data = custom_data['customtag'] - if tag_data: - tag_count = len(tag_data) - tag_list = "\n".join([f"PB-ID: `{pb_id}`\nCUSTOM-TAG: `{tag}`" for pb_id, tag in tag_data.items()]) - await message.channel.send(f">>> **`({tag_count})` Custom tags in {servers}:\n{tag_list}**") - else: - await message.channel.send(">>> **`No one got tag currently in {0}.`**".format(servers)) - else: - await message.channel.send(">>> **No tag data found.**") - - - #effect count cmd :)))))) - elif m[0] == (cmd +'effectlist'): - custom_data = pdata.get_custom() - if custom_data and 'customeffects' in custom_data: - effect_data = custom_data['customeffects'] - if effect_data: - effect_count = len(effect_data) - effect_list = "\n".join([f"PB-ID: `{pb_id}`\nCUSTOM-EFFECT: `{effect}`" for pb_id, effect in effect_data.items()]) - await message.channel.send(f">>> **`({effect_count})` Custom Effects in {servers}:\n{effect_list}**") - else: - await message.channel.send(">>> **`No one got effect currently in {0}.`**".format(servers)) - else: - await message.channel.send(">>> **No effect data found.**") - - #mute count cmd :)))))) - elif m[0] == (cmd +'mutelist'): - black_data = pdata.get_blacklist() - if black_data and 'muted-ids' in black_data: - mute_data = black_data['muted-ids'] - if mute_data: - mute_count = len(mute_data) - mute_list = "\n".join([f"PB-ID: `{pb_id}` " for pb_id, data in mute_data.items()]) - await message.channel.send(f">>> **`({mute_count})` Muted player in {servers}:\n{mute_list}**") - else: - await message.channel.send(">>> **`No one is muted currently in {0}.`**".format(servers)) - else: - await message.channel.send(">>> **No mute data found.**") - - #disable kick vote list and count :)) - elif m[0] == (cmd +'dkickvotelist'): - black_data = pdata.get_blacklist() - if black_data and 'kick-vote-disabled' in black_data: - kickvote_data = black_data['kick-vote-disabled'] - if kickvote_data: - kickvote_count = len(kickvote_data) - kickvote_list = "\n".join([f"PB-ID: `{pb_id}` " for pb_id, data in kickvote_data.items()]) - await message.channel.send(f">>> **`({kickvote_count})` Disable server kick-vote player in {servers}:\n{kickvote_list}**") - else: - await message.channel.send(">>> **`No one is disabled server kick-vote currently in {0}.`**".format(servers)) - else: - await message.channel.send(">>> **No disable server kick-vote data found.**") - - #ban count of any server :> - elif m[0] == (cmd +'banlist'): - black_data = pdata.get_blacklist() - if black_data and 'ban' in black_data: - ban_data = black_data['ban']['ids'] - if ban_data: - ban_count = len(ban_data) - last_10_keys = list(ban_data.keys())[-10:] # Retrieve the last 10 keys - last_10_bans = {pb_id: ban_data[pb_id] for pb_id in last_10_keys} # Retrieve the corresponding data - ban_list = "\n".join([f"PB-ID: `{pb_id}` " for pb_id in last_10_bans]) - await message.channel.send(f">>> <:Cross:1192229645177851994>**`({ban_count})` Last 10 Banned player in {servers}:**") - await message.channel.send(f">>> **{ban_list}**") - else: - await message.channel.send(">>> **`No one is banned currently in {0}.`**".format(servers)) - else: - await message.channel.send(">>> **No banned data found.**") - - #single server ban, which will ban in server files - elif m[0] == (cmd +'ban'): - if len(m) == 4: # Check if the length is 4 to avoid index errors - banned = pdata.get_blacklist() - pb_id, time, reason= m[1], int(m[2]),m[3] - if pb_id in banned['ban']['ids']: - await message.channel.send(f">>> **User is already banned in {servers}** <:emoji_55:995906513031929897>") - else: - pdata.ban_player(pb_id, time, reason) - pdata.update_blacklist() - await message.channel.send(f">>> **Successfully banned `{m[1]}` in {servers} <:ban:1121663704379961465>**") - pdata.mongokick(pb_id) - else: - await message.channel.send(">>> **Invalid Format! Use `{0}{1}ban