Skip to content

Commit f1cafaa

Browse files
committed
code cleanup
1 parent 3b57142 commit f1cafaa

File tree

5 files changed

+31
-45
lines changed

5 files changed

+31
-45
lines changed

general.py renamed to commands/general.py

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import os,sys,discord,asyncio
22
import base64 as b64
3-
sys.path.insert(1, 'modules/')
3+
sys.path.insert(1, '../modules')
44

55
import possiblekeywords
66
from googlesearch import search
@@ -120,7 +120,25 @@ async def meme_(self,ctx):
120120
await button_ctx.edit_origin(embed=func.meme())
121121
except asyncio.exceptions.TimeoutError:
122122
break
123-
123+
124+
@commands.command(name="gs")
125+
async def gs(self, ctx, *, query):
126+
await ctx.author.send(f"Here are the links related to your question!")
127+
for j in search(query, safe='on', start=1, stop=1):
128+
await ctx.author.send(f"\n:point_right: {j}")
129+
await ctx.author.send("Have any more questions:question:\nFeel free to ask again :smiley: !")
130+
131+
@commands.command(name="servers")
132+
async def servers(self, ctx):
133+
await ctx.send(
134+
embed=discord.Embed(description=f"`i am in {len(self.bot.guilds)} guilds`",
135+
color=discord.Color.green()))
136+
137+
@commands.command(name="servname")
138+
async def servname(self,ctx):
139+
names = []
140+
for guild in self.bot.guilds:names.append(f"**`{guild.name}`**")
141+
await ctx.send(embed=discord.Embed(description=f"\n".join(names),color=discord.Color.green()))
124142

125143

126144
def setup(bot):

music.py renamed to commands/music.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import sys
88
import traceback
99

10-
sys.path.insert(1,'./modules')
10+
sys.path.insert(1,'../modules')
1111

1212
import json
1313
import impfunctions as func

slashcog.py renamed to commands/slashcog.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
import sys
33
import base64 as b64
44

5-
sys.path.insert(1, './modules')
5+
sys.path.insert(1, '../modules')
66

77
import time
88
import math
99
import discord
10-
import keep_alive
10+
import modules.keep_alive as keep_alive
1111

1212
import asyncio
1313
#import youtube_dl

main.py

Lines changed: 8 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,24 @@
33
sys.path.insert(1, './modules')
44

55
import discord
6-
import keep_alive
6+
import modules.keep_alive as keep_alive
77
from googlesearch import search
88
from discord.ext import commands
99
from discord_slash import SlashCommand
1010

1111

1212

1313
bot = commands.Bot(command_prefix='.', help_command=None)
14-
1514
slash = SlashCommand(bot,
1615
sync_commands=True,
1716
sync_on_cog_reload=True,
1817
application_id=916685474364534805)
19-
2018
beats_activity = [discord.ActivityType.listening, "Beats"]
21-
22-
extensions = ["music", "general"]
23-
bot.load_extension("music")
24-
bot.load_extension("general")
25-
bot.load_extension("slashcog")
26-
19+
cogs = [
20+
'general',
21+
'music',
22+
'slashcog'
23+
]
2724

2825

2926
@bot.event
@@ -34,37 +31,8 @@ async def on_ready():
3431
type=beats_activity[0], name=beats_activity[1]),
3532
status=discord.Status.dnd)
3633

37-
38-
39-
40-
41-
@bot.command()
42-
async def gs(ctx,*, query):
43-
await ctx.author.send(f"Here are the links related to your question!")
44-
for j in search(query, safe='on', start=1, stop=1):
45-
await ctx.author.send(f"\n:point_right: {j}")
46-
await ctx.author.send("Have any more questions:question:\nFeel free to ask again :smiley: !")
47-
48-
49-
@bot.command()
50-
async def servers(ctx):
51-
await ctx.send(
52-
embed=discord.Embed(description=f"`i am in {len(bot.guilds)} guilds`",
53-
color=discord.Color.green()))
54-
55-
56-
@bot.command()
57-
async def rawserv(ctx):
58-
await ctx.send(bot.guilds)
59-
60-
@bot.command()
61-
async def servname(ctx):
62-
names = []
63-
for guild in bot.guilds:names.append(f"**`{guild.name}`**")
64-
await ctx.send(embed=discord.Embed(description=f"\n".join(names),color=discord.Color.green()))
65-
66-
67-
34+
for file in cogs:
35+
bot.load_extension(f'commands.{file}')
6836

6937

7038
TOKEN = str(os.getenv('TOKEN'))
File renamed without changes.

0 commit comments

Comments
 (0)