From 3f4255ab64e6a461fdd15194f33e14cb09a4b732 Mon Sep 17 00:00:00 2001 From: Uwe Pfeifer Date: Thu, 26 May 2022 15:30:48 +0200 Subject: [PATCH] some first code added. hope the bot.ini doesnt get uploaded. :) for it to work, rename bot.ini.example to bot.ini, edit the file and install discord.py dependency. --- .gitignore | 17 +++----- .idea/.gitignore | 3 ++ .../inspectionProfiles/profiles_settings.xml | 6 +++ README.md | 4 +- bot.ini.example | 6 +++ pybot-f.py | 41 +++++++++++++++++++ 6 files changed, 63 insertions(+), 14 deletions(-) create mode 100644 .idea/.gitignore create mode 100644 .idea/inspectionProfiles/profiles_settings.xml create mode 100644 bot.ini.example diff --git a/.gitignore b/.gitignore index 368abee..57b2dcc 100644 --- a/.gitignore +++ b/.gitignore @@ -229,17 +229,10 @@ fabric.properties # Android studio 3.1+ serialized cache file .idea/caches/build_file_checksums.ser -© 2022 GitHub, Inc. -Terms -Privacy -Security -Status -Docs -Contact GitHub -Pricing -API -Training -Blog -About + +# Added myself +botdev/ +bot.ini + diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 0000000..105ce2d --- /dev/null +++ b/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/README.md b/README.md index d435034..fb4f89f 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ The Discord bot developed by freakyy85. -I develop this bot using discord.py. It should feature slash-commands, extensions inside a modules/ folder, and many more things I -will try to implement. +I develop this bot using discord.py. It should feature slash-commands, extensions inside a modules/ folder, and many +more things I will try to implement. Check by from time to time to see what has changed. :) \ No newline at end of file diff --git a/bot.ini.example b/bot.ini.example new file mode 100644 index 0000000..0f40054 --- /dev/null +++ b/bot.ini.example @@ -0,0 +1,6 @@ +# pybot-f config file. pls rename to bot.ini :) + +# This is the general bot config section. +[General] +bottoken=BOTTOKEN_HERE + diff --git a/pybot-f.py b/pybot-f.py index e69de29..cf190e6 100644 --- a/pybot-f.py +++ b/pybot-f.py @@ -0,0 +1,41 @@ +# pybot-f by freakyy85 (freaky@freakyonline.de) + +import configparser +import discord +from discord.ext import commands + +description = '''Testing this bot stuff :)''' + +intents = discord.Intents.default() +intents.members = True +intents.message_content = True + +# Config loading +config = configparser.ConfigParser() +config.read('bot.ini') +bottoken = config['General']['bottoken'] + + +bot = commands.Bot(command_prefix='?', description=description, intents=intents) + + +@bot.event +async def on_ready(): + print(f'Logged in as {bot.user} (ID: {bot.user.id})') + print('------') + + +@bot.command() +async def repeat(ctx, times: int, content='repeating...'): + """Repeats a message multiple times.""" + for i in range(times): + await ctx.send(content) + + +@bot.command() +async def joined(ctx, member: discord.Member): + """Says when a member joined.""" + await ctx.send(f'{member.name} joined {discord.utils.format_dt(member.joined_at)}') + + +bot.run('OTc5MzU2MjY4NzkzODMxNDI1.GTX-gW.l7Oc7YoVfAQIUBarQ3jXB6upNKYdD0jeCuAGXE') \ No newline at end of file