-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathCreateAccountCommand.cs
32 lines (31 loc) · 1.24 KB
/
CreateAccountCommand.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Squishy.Irc.Commands;
using WCellUtilityBot.Entities;
namespace WCellUtilityBot
{
class CreateAccountCommand : IrcCommand
{
protected override void Initialize()
{
Init("ca","createaccount");
EnglishParamInfo = "partylineUser qUsername";
}
public override void Process(WCell.Util.Commands.CmdTrigger<IrcCmdArgs> trigger)
{
using (var sessionFactory = DBHandler.DBHandler.CreateSessionFactory())
using (var session = sessionFactory.OpenSession())
using (var transaction = session.BeginTransaction())
{
var partylineUser = trigger.Text.NextWord();
var qUsername = trigger.Text.NextWord();
var acc = new Account { Level = AccountLevel.Guest, PartylineUsername = partylineUser, QUsername = qUsername };
session.SaveOrUpdate(acc);
transaction.Commit();
trigger.Reply("Created account with partylineuser: " + partylineUser + " and Qusername: " + qUsername);
}
}
}
}