Skip to content

Commit

Permalink
[V3] complete rewrite because the old one was a mess
Browse files Browse the repository at this point in the history
  • Loading branch information
FO-nTTaX committed Aug 8, 2021
1 parent 9746494 commit dd25cb3
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 9 deletions.
2 changes: 2 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
token=
apikey=
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
/nbproject/
*__pycache__*
.env
8 changes: 4 additions & 4 deletions ftsbot/cogs/channelmoderation.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import discord
from dislash import *
from discord.ext import commands
from ftsbot import data, secrets
from ftsbot import config, data

class channelmoderation(commands.Cog):
def __init__(self, bot):
Expand Down Expand Up @@ -44,7 +44,7 @@ async def channelcreate(self, ctx, member):
overwrites[admin_role1] = discord.PermissionOverwrite(read_messages=True)
if admin_role2 is not None:
overwrites[admin_role2] = discord.PermissionOverwrite(read_messages=True)
channel = await guild.create_text_channel('temp_' + member.name, overwrites=overwrites, category=self.bot.get_channel(int(secrets.privcat)))
channel = await guild.create_text_channel('temp_' + member.name, overwrites=overwrites, category=self.bot.get_channel(int(config.privcat)))
await channel.send('This channel was created to discuss the private request of ' + member.mention)

@slash_commands.has_any_role('Admins', 'Liquipedia Staff')
Expand All @@ -59,7 +59,7 @@ async def channelcopy(self, ctx, channel=None):
else:
await ctx.send(embed=discord.Embed(colour=discord.Colour(0x00ff00), description='Messages have been archived'))
emptyarray = []
logtarget = self.bot.get_channel(secrets.logtarget)
logtarget = self.bot.get_channel(config.logtarget)
async for message in channel.history(limit=10000, oldest_first=True):
time = message.created_at
embed = discord.Embed(
Expand All @@ -85,7 +85,7 @@ async def channelkill(self, ctx, channel=None):
else:
await ctx.send(embed=discord.Embed(colour=discord.Colour(0x00ff00), description='Messages have been archived'))
emptyarray = []
logtarget = self.bot.get_channel(secrets.logtarget)
logtarget = self.bot.get_channel(config.logtarget)
async for message in channel.history(limit=10000, oldest_first='true'):
time = message.created_at
embed = discord.Embed(
Expand Down
10 changes: 10 additions & 0 deletions ftsbot/config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env python3

# License MIT
# Copyright 2016-2021 Alex Winkler
# Version 3.0.0

author = 138719439834185728

logtarget = 339287109988909057 # Here the channel id of the channel we want the private channel logs to be stored in
privcat = 360564294401916929 # This is the id of the "Private Channels" Category
4 changes: 2 additions & 2 deletions ftsbot/functions/decoratorfunctions.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@

from discord.ext import commands
from dislash import *
from ftsbot import secrets
from ftsbot import config

def is_bot_owner():
def predicate(ctx):
if ctx.guild is None:
return False
return ctx.author.id == secrets.author
return ctx.author.id == config.author
return check(predicate)
11 changes: 8 additions & 3 deletions ftsbot/secrets.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,12 @@

token = ''
apikey = ''
author = 138719439834185728

logtarget = 339287109988909057 # Here the channel id of the channel we want the private channel logs to be stored in
privcat = 360564294401916929 # This is the id of the "Private Channels" Category
with open('.env', 'r') as f:
for line in f.readlines():
try:
key, value = line.split('=')
locals()[key] = value
except ValueError:
# syntax error
pass
3 changes: 3 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
discord.py>=1.7.3
dislash.py>=1.2.4
requests>=2.26.0

0 comments on commit dd25cb3

Please sign in to comment.