forked from 6A-Realm/SysBot.py
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SysBot.py release
- Loading branch information
Showing
48 changed files
with
1,829 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
|
||
# SysBot.py | ||
[]() | ||
A sys-botbase client for remote control automation of Nintendo Switch consoles. Based on SysBot.NET, written in python. | ||
|
||
## Setup: | ||
> 1. Download the repo | ||
> 2. Make a discord bot | ||
> 3. Download sys-botbase on your switch | ||
> 4. Fill out the config.yaml | ||
> 5. Install dependencies | ||
> 6. py sysbot.py | ||
## Should I use this bot? | ||
If you want to use this for SysBot: | ||
No. It barely works, I did it for fun. Use [SysBot.NET](https://github.com/kwsch/SysBot.NET) instead. | ||
There is no legality checks and there is no pkx or pbx conversion. | ||
I did not implement anything with offsets other than b1s1. | ||
This was more for fun. Use the other bot for actual SysBot use. | ||
If you want to use this for other features: | ||
I personally use it along side SysBot.NET. | ||
It has some nice features, especially if the bot is used in multiple servers. | ||
|
||
## Something doesn't work correctly: | ||
Not everything is tested and I doubt everything will work as expected. | ||
> If you want to open an issue then I might take a look at it. If you want to fork and fix then I could always pull as well. | ||
## I need more help: | ||
Ask nicely and I might have an answer | ||
[<img src="https://canary.discordapp.com/api/guilds/771539948687589386/widget.png?style=banner2">](https://discord.gg/TwyCFr5WDY) | ||
|
||
## Future goals: | ||
Feel free to fork and do the stuff I couldn't. | ||
|
||
### Touchscreen input: | ||
- [] More accurate trade code input | ||
### CoreApi | ||
- [] Encryption and Decryption | ||
- [] Legality Checks | ||
### Screen capture | ||
- [] Fix pixelPeek | ||
### Offset Checks | ||
- [] Make it more stable | ||
|
||
## Credits: | ||
- [olliz0r's sys-botbase](https://github.com/olliz0r/sys-botbase): Switch automation and pokemon injection | ||
- [kwsch](https://github.com/kwsch/SysBot.NET): Offsets needed for b1s1 | ||
- [Manu098vm](https://github.com/Manu098vm): Teaching me how to use offsets correctly | ||
- [GriffinG1](https://github.com/GriffinG1/FlagBot): Stole some stuff from Flagbot like the error handler and how he did legality checks | ||
- Santa, Bewears, Bones: Giving me ideas and fixing errors | ||
|
||
## License: | ||
[AGPLv3+](https://www.gnu.org/licenses/agpl-3.0.en.html) | ||
|
||
This is free software, and you are welcome to redistribute it under certain conditions. | ||
|
||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU Affero General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
|
||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU Affero General Public License for more details. | ||
|
||
You should have received a copy of the GNU Affero General Public License | ||
along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
|
||
For more details on this issue, check the [COPYING](COPYING) file. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
userblacklist: | ||
- null |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
channels: | ||
- null | ||
- 860765383908655144 | ||
- 901881910886826064 | ||
- 860767720530640916 | ||
- 860959157163393064 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
log: | ||
- null |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
priority: | ||
- null |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
sudo: | ||
- null |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import discord | ||
from discord.ext import commands | ||
import asyncio | ||
|
||
class admin(commands.Cog): | ||
def __init__(self, client): | ||
self.client = client | ||
|
||
@commands.command(help="Prevents members from type in used channel.", brief='lock') | ||
@commands.has_permissions(manage_channels=True) | ||
async def lock(self, ctx, channel : discord.TextChannel=None): | ||
channel = channel or ctx.channel | ||
overwrite = channel.overwrites_for(ctx.guild.default_role) | ||
overwrite.send_messages = False | ||
await ctx.message.delete() | ||
await channel.set_permissions(ctx.guild.default_role, overwrite=overwrite) | ||
await ctx.send(':red_circle: **Channel locked.** This bot is offline, please use one of the other bots.') | ||
if ctx.channel.id == 860765383908655144: | ||
down = discord.Embed(title="LGPE Bot Is Down!", description=f"Many users have been experiencing bot disconnection, meaning that they cannot complete their trades. This means the bot has crashed; therefore, this channel has been locked.\n\n\n**Do not DM anyone about the bot. Do not ask when the bot will be up.**\n\n\nRemember, this is a free service that nobody else offers. This is also something that the other sysbot creators said would be impossible to make.\n\n\nThank you for waiting patiently.", colour=discord.Colour.orange()) | ||
down.set_footer(text="Failure to follow bolded line will result in a ban.") | ||
await ctx.send(embed = down) | ||
|
||
@commands.command(help="Allows members to type in used channel.", brief='unlock') | ||
@commands.has_permissions(manage_channels=True) | ||
async def unlock(self, ctx, channel : discord.TextChannel=None): | ||
channel = channel or ctx.channel | ||
overwrite = channel.overwrites_for(ctx.guild.default_role) | ||
overwrite.send_messages = True | ||
await ctx.message.delete() | ||
await channel.set_permissions(ctx.guild.default_role, overwrite=overwrite) | ||
await ctx.send(':green_circle: **Channel unlocked.** This bot is now online and ready to use.') | ||
|
||
@commands.command(aliases=['repeat']) | ||
@commands.has_permissions(manage_channels=True) | ||
async def say(self, ctx,*,message): | ||
await ctx.send(f"{message}") | ||
|
||
@commands.command(pass_context=True) | ||
@commands.has_permissions(manage_channels=True) | ||
async def purge(self, ctx, limit: int): | ||
await ctx.channel.purge(limit=limit+1) | ||
response = await ctx.send(f'{limit} messages cleared by {ctx.author}') | ||
await asyncio.sleep(2) | ||
await response.delete() | ||
|
||
|
||
@commands.command(help="Sets a slowmode in used channel.", brief='slowmode <amount>') | ||
@commands.has_permissions(manage_channels=True) | ||
async def slowmode(self, ctx, seconds: int): | ||
await ctx.channel.edit(slowmode_delay=seconds) | ||
await ctx.send(f"Set the slowmode delay in this channel to {seconds} seconds!") | ||
|
||
@commands.command() | ||
@commands.has_permissions(manage_channels=True) | ||
async def downmessage(self, ctx): | ||
down = discord.Embed(title="LGPE Bot Is Down!", description=f"Many users have been experiencing bot disconnection, meaning that they cannot complete their trades. This means the bot has crashed; therefore, this channel has been locked.\n\n\n**Do not DM anyone about the bot. Do not ask when the bot will be up.**\n\n\nRemember, this is a free service that nobody else offers. This is also something that the other sysbot creators said would be impossible to make.\n\n\nThank you for waiting patiently.", colour=discord.Colour.orange()) | ||
down.set_footer(text="Failure to follow bolded line will result in a ban.") | ||
await ctx.send(embed = down) | ||
|
||
|
||
def setup(client): | ||
client.add_cog(admin(client)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
import discord | ||
from discord import client | ||
from discord.ext import commands | ||
import yaml | ||
from yaml import load, dump | ||
|
||
# Simple file reader to load advanced settings | ||
with open("advanced/blacklist.yaml", encoding='utf-8') as file: | ||
data = load(file) | ||
userblacklist = data["userblacklist"] | ||
|
||
with open("advanced/logs.yaml", encoding='utf-8') as file: | ||
data = load(file) | ||
log = data["log"] | ||
|
||
with open("advanced/priority.yaml", encoding='utf-8') as file: | ||
data = load(file) | ||
priority = data["priority"] | ||
|
||
with open("advanced/sudo.yaml", encoding='utf-8') as file: | ||
data = load(file) | ||
sudo = data["sudo"] | ||
|
||
class advanced(commands.Cog): | ||
def __init__(self, client): | ||
self.client = client | ||
|
||
# {-- Advanced Settings Commands --} | ||
@commands.command(pass_context=True) | ||
@commands.is_owner() | ||
async def addsuo(self, ctx, user: discord.User): | ||
person = user.id | ||
with open("advanced/sudo.yaml", encoding='utf-8') as file: | ||
data = load(file) | ||
if person in data["sudo"]: | ||
await ctx.send('This user already has sudo perms.') | ||
else: | ||
data["sudo"].append(person) | ||
sudo.append(person) | ||
with open('advanced/sudo.yaml', 'w') as writer: | ||
yaml.dump(data, writer) | ||
|
||
await ctx.send('This user now has sudo permissons.') | ||
|
||
@commands.command(pass_context=True) | ||
@commands.is_owner() | ||
async def removesudo(self, ctx, user: discord.User): | ||
person = user.id | ||
with open("advanced/sudo.yaml", encoding='utf-8') as file: | ||
datachan = load(file) | ||
datachan["sudo"].remove(person) | ||
sudo.remove(person) | ||
with open('advanced/sudo.yaml', 'w') as writer: | ||
yaml.dump(datachan, writer) | ||
await ctx.send('This user no longer has sudo permissons.') | ||
|
||
@commands.command(pass_context=True) | ||
@commands.is_owner() | ||
async def blacklist(self, ctx, user: discord.User): | ||
person = user.id | ||
with open("advanced/blacklist.yaml", encoding='utf-8') as file: | ||
datachan = load(file) | ||
if person in datachan["userblacklist"]: | ||
await ctx.send('This user already blacklisted.') | ||
else: | ||
datachan["userblacklist"].append(person) | ||
userblacklist.append(person) | ||
with open('advanced/blacklist.yaml', 'w') as writer: | ||
yaml.dump(datachan, writer) | ||
|
||
await ctx.send('This user now has blacklisted from using the bot.') | ||
|
||
@commands.command(pass_context=True) | ||
@commands.is_owner() | ||
async def unblacklist(self, ctx, user: discord.User): | ||
person = user.id | ||
with open("advanced/blacklist.yaml", encoding='utf-8') as file: | ||
datachan = load(file) | ||
datachan["userblacklist"].remove(person) | ||
userblacklist.remove(person) | ||
with open('advanced/blacklist.yaml', 'w') as writer: | ||
yaml.dump(datachan, writer) | ||
await ctx.send('This user no longer blacklisted.') | ||
|
||
@commands.command(pass_context=True) | ||
@commands.is_owner() | ||
async def loghere(self, ctx): | ||
channel = ctx.message.channel.id | ||
|
||
with open("advanced/logs.yaml", encoding='utf-8') as file: | ||
data = load(file) | ||
if channel in data["log"]: | ||
await ctx.send('This channel is already listed in the update list.') | ||
else: | ||
data["log"].append(channel) | ||
log.append(channel) | ||
with open('advanced/logs.yaml', 'w') as writer: | ||
yaml.dump(data, writer) | ||
|
||
await ctx.send('This channel has been added. You will now get announcements in this channel.') | ||
|
||
@commands.command(pass_context=True) | ||
@commands.is_owner() | ||
async def dontlog(self, ctx): | ||
channel = ctx.message.channel.id | ||
with open("advanced/logs.yaml", encoding='utf-8') as file: | ||
data = load(file) | ||
try: | ||
data["log"].remove(channel) | ||
log.remove(channel) | ||
with open('advanced/logs.yaml', 'w') as writer: | ||
yaml.dump(data, writer) | ||
await ctx.send('This channel has been removed. You will no longer get announcements in this channel.') | ||
except: | ||
await ctx.send('An error occured. Please try again later.') | ||
|
||
|
||
def setup(client): | ||
client.add_cog(advanced(client)) |
Oops, something went wrong.