Compare commits
2 Commits
73ce1f71e7
...
6f54322a3e
Author | SHA1 | Date |
---|---|---|
|
6f54322a3e | |
|
a778140737 |
|
@ -1,2 +1,4 @@
|
|||
.env
|
||||
launch.sh
|
||||
launch.sh
|
||||
src/bot/__pycache__
|
||||
src/commands/__pycache__
|
|
@ -2,9 +2,9 @@
|
|||
"version": "2.0.0",
|
||||
"tasks": [
|
||||
{
|
||||
"label": "Run Project",
|
||||
"label": "Start Bot",
|
||||
"type": "shell",
|
||||
"command": "launch.sh",
|
||||
"command": "./launch.sh",
|
||||
"problemMatcher": [],
|
||||
"group": {
|
||||
"kind": "build",
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
"""
|
||||
Bot package - Discord bot manager
|
||||
"""
|
||||
|
||||
__all__ = ["setup_bot", "start_bot"]
|
||||
|
||||
from .bot import *
|
|
@ -0,0 +1,34 @@
|
|||
import discord
|
||||
from discord.ext import commands
|
||||
|
||||
from dotenv import load_dotenv
|
||||
from os import getenv
|
||||
|
||||
from commands.discord_commands import *
|
||||
|
||||
def setup_bot() -> commands.Bot:
|
||||
print("Configuring bot...")
|
||||
load_dotenv()
|
||||
|
||||
bot = commands.Bot(command_prefix="/", intents=discord.Intents.all())
|
||||
|
||||
@bot.event
|
||||
async def on_ready():
|
||||
try:
|
||||
synced = await bot.tree.sync()
|
||||
print(f"Successfully synced {len(synced)} commands")
|
||||
except Exception as e:
|
||||
print(e)
|
||||
print("Bot ready !")
|
||||
|
||||
setup_commands(bot)
|
||||
|
||||
return bot
|
||||
|
||||
def start_bot(bot: commands.Bot) -> None:
|
||||
print("Starting bot...")
|
||||
token = getenv("DISCORD_TOKEN")
|
||||
if token:
|
||||
bot.run(token)
|
||||
else:
|
||||
print("token error")
|
|
@ -0,0 +1,7 @@
|
|||
"""
|
||||
Commands package - Discord commands manager
|
||||
"""
|
||||
|
||||
__all__ = ["setup_commands"]
|
||||
|
||||
from .discord_commands import *
|
|
@ -0,0 +1,7 @@
|
|||
import discord
|
||||
from discord.ext import commands
|
||||
|
||||
def setup_commands(bot: commands.Bot) -> None:
|
||||
@bot.tree.command(name="trustme", description="Come on, shake your body baby.")
|
||||
async def trustme(interaction: discord.Interaction):
|
||||
await interaction.response.send_message("https://matias.ma/nsfw/")
|
47
src/main.py
47
src/main.py
|
@ -1,52 +1,37 @@
|
|||
from dis import disco
|
||||
import discord
|
||||
import os
|
||||
from discord.ext import commands
|
||||
from dotenv import load_dotenv
|
||||
from bot import *
|
||||
|
||||
load_dotenv()
|
||||
|
||||
print("Launching DeltaBot...")
|
||||
bot = setup_bot()
|
||||
|
||||
#bot = discord.Client(intents=discord.Intents.all())
|
||||
bot = commands.Bot(command_prefix="/", intents=discord.Intents.all())
|
||||
|
||||
#bot_channel = bot.get_channel(1424301304225857667)
|
||||
|
||||
@bot.event
|
||||
async def on_ready():
|
||||
try:
|
||||
synced = await bot.tree.sync()
|
||||
print(f"Successfully synced {len(synced)} commands")
|
||||
except Exception as e:
|
||||
print(e)
|
||||
|
||||
print("Bot ready !")
|
||||
|
||||
@bot.event
|
||||
async def on_message(message: discord.Message):
|
||||
if message.author.bot:
|
||||
return
|
||||
|
||||
message_content = message.content.lower().__str__()
|
||||
words = message.content.lower().split()
|
||||
channel = message.channel
|
||||
|
||||
if message_content.__contains__("bonjour"):
|
||||
if "bonjour" in words:
|
||||
await channel.send("bien dormii ?? (˶ᵔᵕᵔ˶)₊˚⊹♡")
|
||||
|
||||
if message_content.__contains__("ui"):
|
||||
if any(mot in words for mot in ["oui", "ui", "ouai", "ouaip", "yes", "yep"]) and not message.content.__contains__("?"):
|
||||
await channel.send("trow bienn~ (˶ᵔᵕᵔ˶) ‹𝟹")
|
||||
|
||||
if message_content.__contains__("<@1169377208893194275>"):
|
||||
if "<@1169377208893194275>" in words:
|
||||
await channel.send("c'est mon mimi nathan qu'on tag ?? ⸜(。˃ ᵕ ˂)⸝♡")
|
||||
await channel.send("UwU")
|
||||
|
||||
@bot.tree.command(name="trustme", description="Come on, shake your body baby.")
|
||||
async def trustme(interaction: discord.Interaction):
|
||||
await interaction.response.send_message("https://matias.ma/nsfw/")
|
||||
if "c" in words:
|
||||
await channel.send("le C c'est trow bienn~ (⸝⸝>ᴗ•⸝⸝)")
|
||||
|
||||
token = os.getenv("DISCORD_TOKEN")
|
||||
if token:
|
||||
bot.run(token)
|
||||
else:
|
||||
print("token error")
|
||||
if "c++" in words:
|
||||
await channel.send("le C++ c'est trow coool ╰(°ㅂ°)╯")
|
||||
|
||||
def main():
|
||||
start_bot(bot)
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
Loading…
Reference in New Issue