Read guild from config file
parent
21384b9a35
commit
c48b45d9bf
8
bot.py
8
bot.py
|
@ -12,6 +12,10 @@ import discord.utils
|
||||||
|
|
||||||
BOOT_TIME = time.time()
|
BOOT_TIME = time.time()
|
||||||
|
|
||||||
|
config_file = open("config.json", "r")
|
||||||
|
config = json.loads(config_file.read());
|
||||||
|
config_file.close()
|
||||||
|
|
||||||
def seconds_elapsed():
|
def seconds_elapsed():
|
||||||
return time.time() - BOOT_TIME
|
return time.time() - BOOT_TIME
|
||||||
|
|
||||||
|
@ -36,7 +40,7 @@ async def on_ready():
|
||||||
print('------')
|
print('------')
|
||||||
|
|
||||||
|
|
||||||
@client.tree.command(guild=discord.Object(id=813127962881818624), name="change_hostname")
|
@client.tree.command(guild=discord.Object(id=config["guild"]), name="change_hostname")
|
||||||
@app_commands.describe(distro='Assign yourself a role')
|
@app_commands.describe(distro='Assign yourself a role')
|
||||||
async def distro(interaction: discord.Interaction, distro: typing.Literal[
|
async def distro(interaction: discord.Interaction, distro: typing.Literal[
|
||||||
'LFS', 'Kiss', 'Gentoo', 'Void', 'NixOS', 'Alpine',
|
'LFS', 'Kiss', 'Gentoo', 'Void', 'NixOS', 'Alpine',
|
||||||
|
@ -174,7 +178,7 @@ async def distro(interaction: discord.Interaction, distro: typing.Literal[
|
||||||
|
|
||||||
|
|
||||||
# This context menu command only works on messages
|
# This context menu command only works on messages
|
||||||
@client.tree.context_menu(guild=discord.Object(id=813127962881818624), name='Report to Moderators')
|
@client.tree.context_menu(guild=discord.Object(id=config["guild"]), name='Report to Moderators')
|
||||||
async def report_message(interaction: discord.Interaction, message: discord.Message):
|
async def report_message(interaction: discord.Interaction, message: discord.Message):
|
||||||
await interaction.response.send_message(
|
await interaction.response.send_message(
|
||||||
f'Thanks for reporting this message by {message.author.mention} to our moderators.', ephemeral=True
|
f'Thanks for reporting this message by {message.author.mention} to our moderators.', ephemeral=True
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
{
|
||||||
|
"guild": 750955881348464651,
|
||||||
|
"roles": {
|
||||||
|
"assign0": 1063506453308125274,
|
||||||
|
"assign1": 1063506544962064414
|
||||||
|
},
|
||||||
|
"report channel": 1063507041697677312
|
||||||
|
}
|
Loading…
Reference in New Issue