Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename main Bot folder to IngiBot + attempt to repair welcome message #12

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 0 additions & 16 deletions Bot/run.py

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
26 changes: 15 additions & 11 deletions Bot/message_parser.py → IngiBot/message_parser.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
# created by Sami Bosch on Thursday, 08 November 2018

# This file contains all functions necessary to reply to messages
import base64
import codecs
from datetime import date
import json
import logging
import random
import time
from datetime import date
import socket
import time
from urllib.request import urlopen
from urllib.error import URLError

Expand All @@ -14,9 +17,8 @@

from course_handler import create_course, get_courses
from discord_utils import AsyncTimer, conv_time
from mylog import logthis
from tex_handler import *
import base64
import codecs

haddock = '../haddock.json'
dirname = os.path.dirname(__file__)
Expand Down Expand Up @@ -381,11 +383,13 @@ async def hextostr(self, context):

@client.event
async def on_member_join(member):
server = member.server
logging.info(f"New member join: {member}")
server = member.guild
welcome = server.get_channel(509372274143657984)
await welcome.send_message("Bonjour %s et bienvenue dans le serveur SINFO! Indique ton nom et ta section "
"d'études (p.ex. 'Ingi Bot - sinf') ici pour qu'un modérateur puisse te vérifier "
"et te donner accès au reste du serveur.\n\nHey there and welcome %s! Please give "
"your name and the studies you're following (e.g. 'Ingi Bot - sinf') so a "
"moderator can verify you and give you access to the rest of the server."
% (member.mention, member.mention))
await welcome.send("Bonjour %s et bienvenue dans le serveur SINFO! Indique ton nom et ta section "
"d'études (p.ex. 'Ingi Bot - sinf') ici pour qu'un modérateur puisse te vérifier "
"et te donner accès au reste du serveur.\n\nHey there and welcome %s! Please give "
"your name and the studies you're following (e.g. 'Ingi Bot - sinf') so a "
"moderator can verify you and give you access to the rest of the server."
% (member.mention, member.mention))

26 changes: 26 additions & 0 deletions IngiBot/run.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# created by Sami Bosch on Thursday, 08 November 2018

# This file contains all functions necessary to start up the bot

import logging
import discord
from discord.ext.commands import Bot
from message_parser import init


class IngiBot(Bot):
async def on_command(self, context):
msg = context.message
logging.info(f"Received message \"{msg}\", \"{msg.content if hasattr(msg, 'content') else ''}\" to be handled by the bot")


def runbot(token):
"""Initializes the client's command handler and other non command related functionalities."""
logging.basicConfig(level=logging.INFO, format='%(asctime)s:%(levelname)s:%(name)s:%(funcName)s: %(message)s')
intents = discord.Intents.default()
intents.members = True
client = IngiBot(command_prefix="!", intents=intents)

init(client)

client.run(token)
File renamed without changes.