Skip to content

Commit

Permalink
itskekoff#9 feature added
Browse files Browse the repository at this point in the history
  • Loading branch information
itskekoff committed Mar 18, 2023
1 parent 4155bd2 commit 2c95189
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,14 @@ If script gives KeyError, save token and delete config.json, then configure agai
Type in any guild: cp!clone (or copy, paste, parse). "cp!" is prefix that you defined in config.json
If you don't have permission to write to a server, you can add the argument <server id> to the command, which will allow you to copy the server by id, either in lp or on another server.
The main thing is just to go to the server.
Example commands:
* cp!clone - Copy the server in which the command was executed.
* cp!clone <server id> - Copy the server whose ID was specified in the executed command.
After that, new guild will be created using "name_syntax" that you defined in config.json
"name_syntax" supports only "%original" parameter
Expand Down
11 changes: 6 additions & 5 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -352,13 +352,14 @@ async def on_message(message: discord.Message):


@bot.command(name="copy", aliases=["clone", "paste", "parse"])
async def copy(ctx: commands.Context):
async def copy(ctx: commands.Context, server_id: int = None):
global cloner_instances, register_on_message
await ctx.message.delete()
if ctx.message.guild is None:
guild: discord.Guild = bot.get_guild(id=server_id) if server_id else ctx.message.guild
if guild is None and server_id is None:
return
print("* Creating server... | " + ctx.guild.name)
guild: discord.Guild = ctx.guild

print("* Creating server... | " + guild.name)
new_guild: discord.Guild = await bot.create_guild(name=name_syntax.replace("%original", guild.name))
cloner: ServerCopy = ServerCopy(from_guild=guild, to_guild=new_guild,
delay=clone_delay, webhook_delay=messages_delay)
Expand All @@ -381,5 +382,5 @@ async def copy(ctx: commands.Context):
print("* Done")


Updater("1.2.3")
Updater("1.2.4")
bot.run(token)

0 comments on commit 2c95189

Please sign in to comment.