Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
kavin-jindal authored Nov 8, 2021
1 parent 9df8bf5 commit 78268b2
Show file tree
Hide file tree
Showing 3 changed files with 149 additions and 0 deletions.
1 change: 1 addition & 0 deletions ascord/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from .ascordfuncs import *
114 changes: 114 additions & 0 deletions ascord/ascordfuncs.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
import os

def ncord(bot_name, c_prefix, token):
script = f'''
# embed script
import discord
from discord.ext import commands
bot = commands.Bot(command_prefix = f"{c_prefix}")
# Generated using Astro Cord
@bot.event
async def on_ready():
print("bot is online")
@bot.command()
async def ping(ctx):
await ctx.send("Pong!")
@bot.command()
async def hello(ctx):
await ctx.send("Hey there!")
@bot.command()
async def embed(ctx):
sample_embed = discord.Embed(
title = "This is a sample embed",
colour = discord.Colour.red()
)
sample_embed.add_field(name = 'This is a sample field', value='This is a field value', inline=False)
sample_embed.set_image(url=ctx.author.avatar_url)
sample_embed.set_author(name=ctx.author.display_name, icon_url=ctx.author.avatar_url)
sample_embed.set_thumbnail(url="https://i.imgur.com/axLm3p6.jpeg")
sample_embed.set_footer(text="This is a footer")
await ctx.send(embed = sample_embed)
bot.run(f"{token}")
'''
botfile = open(f"{bot_name}.py", "w")
botfile.write(script)
print("Generated!")

def as_cogs(bot_name, c_prefix, token):
os.makedirs(f"{bot_name}/cogs")
botfile = open(f"{bot_name}/cogs/start.py", "w")
botfile_main = open(f"{bot_name}/main.py", "w")
botfile.write(f"""
import discord
from discord.ext import commands
from discord import DMChannel
import random
from datetime import datetime
from discord import Intents
class Start(commands.Cog):
def __init__(self, client):
self.client = client
@commands.Cog.listener()
async def on_ready(self):
print('Bot is online')
await self.client.change_presence(status = discord.Status.idle, activity=discord.Activity(type=discord.ActivityType.watching, name='Developed by Astro Inc. || m!help'))
@commands.command()
async def test(self, ctx):
await ctx.send('Hello there')
def setup(client):
client.add_cog(Start(client))
""")
botfile_main.write(f"""
import discord
from discord.ext import commands
import os
from discord.utils import get
import praw
from discord.ext.commands import Bot
import platform
import asyncio
from discord import Intents
intents = Intents.all()
client = commands.Bot(command_prefix='{c_prefix}')""" + """\n
@client.command()
@commands.is_owner()
async def load(ctx, extension):
client.load_extension(f'cogs.{extension}')
await ctx.send(f'```Loaded {extension} extension```')
@client.command()
@commands.is_owner()
async def unload(ctx, extension):
client.unload_extension(f'cogs.{extension}')
await ctx.send(f'```Unloaded `{extension}` extension```')
for filename in os.listdir('./cogs'):
if filename.endswith('.py'):
client.load_extension(f'cogs.{filename[:-3]}')
""" + f"""
client.run(f'{token}')
""")
print("Generated!!")



34 changes: 34 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
from setuptools import setup, find_packages
import codecs
import os

here = os.path.abspath(os.path.dirname(__file__))

with codecs.open(os.path.join(here, "README.md"), encoding="utf-8") as fh:
long_description = "\n" + fh.read()

VERSION = '0.0.5'
DESCRIPTION = 'Generating Python Discord bots'
LONG_DESCRIPTION = '# Helps is generating ready-made discord bots in python easily.'

# Setting up
setup(
name="ascord",
version=VERSION,
author="Kavin Jindal",
author_email="kavinsjindal@gmail.com",
description=DESCRIPTION,
long_description_content_type="text/markdown",
long_description= long_description,
packages=find_packages(),
install_requires=['discord'],
keywords=['python','discord', 'discord.py', 'discord bots', 'discord python', 'bots'],
classifiers=[
"Development Status :: 7 - Inactive",
"Intended Audience :: Developers",
"Programming Language :: Python :: 3",
"Operating System :: Unix",
"Operating System :: MacOS :: MacOS X",
"Operating System :: Microsoft :: Windows",
]
)

0 comments on commit 78268b2

Please sign in to comment.